Announcement

Collapse
No announcement yet.

Controlling VrayObjectProperties in Xrefs?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Controlling VrayObjectProperties in Xrefs?

    All,

    Here's a good one! For everyone that has had to make a LOT of Matte shadow files before and remember to keep them up to date when you change the master file.

    I am wondering if/how you could overide all the vray object properties (ie making the objects matte shadow, and -1 in the alpha) within an xref'd file, but to only the chosen file, not globally?

    I saw in RPmanager you can overide an xref's materials and not effect other xrefs, and I dont want to mess up the materials of the Mattes due to colour bleed/reflections etc.

    Can this be done, or is it AutoDesk's problem?

    Thanks

  • #2
    Nobody got any ideas?

    Comment


    • #3
      XRef Objects would probably work instead of XRef Scene...I've been trying to figure this out as well.
      Colin Senner

      Comment


      • #4
        You can access just about any properties for an object in a xref scene through
        Code:
        <XRefScene>.tree Node
        Check out the xref Scene Values in the maxscript help

        We've created helper objects in the past that would override the materials for objects in an xref scene so I know it is doable, that and thanks to Keith our Script Guru for refreshing my memory.
        Eric Boer
        Dev

        Comment


        • #5
          Good ideas, I'll try xref objects, but that is not an easy method when its a massive scene your xref'ing.

          I was thinking a new tab in Vray called overides, where the global material overides could be moved to. In there could be overides for the xrefs, and overides for the scene, and xref vray parameters. I wonder if Vlado can help here?

          Im really only interested in controlling the objects properties to get them to matte shadows, to specific xref's. An example use would be to render out a static landscape as a base layer, then override to a matte, and render moving obecjts on top. Currently I have to make a copy if the landscape scene, and make that a matte.

          I think this is an issue a lot of people must have when splitting their scenes for rendering, and many other reasons.

          Comment


          • #6
            Originally posted by RErender View Post
            You can access just about any properties for an object in a xref scene through
            Code:
            <XRefScene>.tree Node
            Check out the xref Scene Values in the maxscript help

            We've created helper objects in the past that would override the materials for objects in an xref scene so I know it is doable, that and thanks to Keith our Script Guru for refreshing my memory.
            Hi,

            Do you think it would be possible to control the vray properties of an object being xref'd in?

            Thanks

            Comment


            • #7
              yes you can, here is how

              Code:
              (
                  theXRefScene = xrefs.getXRefFile 1  -- the XRefScene
                  xroot = theXRefScene.tree.children  -- the objects in the XRefScene
                  
                  for x in xroot do (  -- for every object in the xrefscene
                      if isValidNode x then (  -- makes sure the node is valid
                          try (setUserProp x "VRay_Matte_Alpha" -1) catch()  -- attempts to set the VRay_Matte_Alpha to -1, easy error checking
                      )  -- end isValidNode
                  )  -- end for
              )
              Takes the first xref scene and sets the VRay_Matte_Alpha (alpha contribution) to -1 eliminating it.

              Works great.
              -Colin
              Last edited by MoonDoggie; 23-09-2008, 08:51 AM.
              Colin Senner

              Comment


              • #8
                nice one Colin...!

                Comment


                • #9
                  sweet, Ill try it in the morning, if it works, that will save me a LOT of time!!

                  Does that script change all objects in an xref to matte shadow?

                  How can you use the script to set an xref that is not the first in the list, just change the number? Also does it permanently change the xref scene, or only in the file you use the script?

                  Many thanks

                  Comment


                  • #10
                    I created a simple xref scene with a box,cylinder,and sphere and then saved it, and xrefed it into another scene. I rendered it produced the correct alpha, then I ran the script and rendered and the alpha was blank just as it should have been.

                    - It doesn't change the objects to Matte Shadow, but I'll show you how to do that

                    - It only changes the objects in the scene not in the original xref file

                    - Yes, changing the number by xrefs.getXRefFile will change what xref you are editing, of course you might want to have the script run through all xrefs.

                    Code:
                    fn setXRefScenesToMatte = (
                        if (local xrefCount = xrefs.getXRefFileCount()) != 0 then (
                            for i = 1 to xrefCount do (     -- get each xref scene in the file
                                local xrscene = xrefs.getXRefFile i    -- xrscene equals the xref scene in which is loaded
                                
                                for x in (xrscene.tree.children) do (    -- for each object in the xref scene
                                    try (
                                        setUserProp x "VRay_Matte_Enable" true    -- sets the object to a matte object
                                        setUserProp x "VRay_Matte_Alpha" -1    -- sets the alpha contribution to -1, consider using 0 as well
                                    ) catch ()
                                )    -- end each object in scene
                            )    -- end all xrefs done
                            true
                        ) else false
                    )
                    
                    fn resetXRefScenes = (
                        if (local xrefCount = xrefs.getXRefFileCount()) != 0 then (
                            for i = 1 to xrefCount do (     -- get each xref scene in the file
                                local xrscene = xrefs.getXRefFile i    -- xrscene equals the xref scene in which is loaded
                                
                                for x in (xrscene.tree.children) do (    -- for each object in the xref scene
                                    try (
                                        setUserProp x "VRay_Matte_Enable" false    -- sets the object NOT to a matte object
                                        setUserProp x "VRay_Matte_Alpha" 1    -- sets the alpha contribution to 1
                                    ) catch ()
                                )    -- end each object in scene
                            )    -- end all xrefs done    
                            true
                        ) else false
                    )
                    to use, just type

                    setXRefScenesToMatte()

                    in the listener and press enter, or shift-enter

                    to reset the xref objects type

                    resetXRefScenes()

                    -Colin
                    Last edited by MoonDoggie; 26-09-2008, 01:19 PM.
                    Colin Senner

                    Comment


                    • #11
                      When I find some time at home I'll write a comprehensive matte pass generator.

                      I dont like all the ones out that don't give you exact control of your matte pass so I end up doing it by hand anyway, any suggestions?
                      Colin Senner

                      Comment


                      • #12
                        All I can says is COOOOL!!

                        I have been on to Vlado for a while to see how a global overide on xrefs for this exact process could be included in the Vray setting.

                        If you make a proper little app to controll the overide setting of xrefs, Im sure near all visualisers will use it. I spend so much time making matte shadow versions of files and then forgetting to update them when I update a model file!!

                        This way we can have 1 model file, 1 gls etc, and make the mattes in the render file as and when without messing with the xref files.

                        Comment


                        • #13
                          How would you like it to operate and what features would you like to see incorporated?

                          I'll have a small control list on one side for vrayproperties settings for MATTE objects, and one for non-matte objects. I'll have a button that then applies the settings and a button that resets the settings.

                          The harder part is having it save all of the original vrayproperties so when you restore them, they go back to the way they were.

                          Any other ideas?
                          -Colin
                          Colin Senner

                          Comment


                          • #14
                            Cool, I think if it takes a list form as you say, as the xref diag does, but has tick boxes for the verious setting to be overided.

                            Id say you need a box for Matte object, alpha (a number box), shadows, and affect alpha.

                            I think they are the 4 main control people would use for this.

                            Ill have to have a think about it, and Ill get some other peeps in the office to comment.

                            Cheers

                            Comment


                            • #15
                              yeah, maybe even a mockup of the ui with the visual maxscript editor! Let me know.
                              Colin Senner

                              Comment

                              Working...
                              X