Announcement

Collapse
No announcement yet.

Controlling VrayObjectProperties in Xrefs?

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

  • #31
    Wrote half of it two days ago, I'll finish it up tonight or tomorrow. It is a whole MattePass manager, it isn't just for xrefs, but it does support xrefs as well. I think you'll find it comprehensive.

    -Colin
    Colin Senner

    Comment


    • #32
      Very cool, cant wait to test it!

      Thanks again

      Comment


      • #33
        I can't wait!

        Will this work on Max 2008 and 2009?

        Comment


        • #34
          It will be supported for Max 2008+ using some of the new 2008 AVG Extensions. It will be done and posted tonight, I'll expect some good feedback over the next few days and I'll revise it by the weekend.

          -Colin

          EDIT: Finishing it sunday, heading out of town Tonight/Saturday.
          Last edited by MoonDoggie; 10-10-2008, 04:33 PM.
          Colin Senner

          Comment


          • #35
            We're still on 2008 so Im happy!

            Ill test in multiple scenes and over network as soon as I get it!

            Thanks again

            Comment


            • #36
              I am so close to finishing it! I almost finished it last night, the xref functionality isn't built in yet as well as overriding vraymtlwrappers if the user specifies. I'll work on it today and lunch and get it finished. Has anyone found a way to get xref overrides for network submissions? If no-one has I'll register a callback in the script to do just that, which should take care of it! It it works as is then I won't worry about it.

              -Colin
              Colin Senner

              Comment


              • #37
                Getting xrefs to work correctly over backburner is not working correctly and is proving to be more difficult than originally thought. I'll keep at it.
                Colin Senner

                Comment


                • #38
                  Does it have anything to do with Max not updating the XRefs when it opens them during a network render? Is there anyway to force it to do so?

                  The only way I've found to get it to update them is to have there be an atmospheric effect of some kind (like fire) in the file to be xref'ed in. Then it will update them.

                  I appreciate your work on this as I'm sure it will come in very handy. When you're done, I'll lobby for my boss to send you some $$ for your hard work. No guarantees, though.

                  Comment


                  • #39
                    I've almost abandoned xrefs truthfully.. if you guys are getting them to be actually usable I'd be curious how
                    Dave Buchhofer. // Vsaiwrk

                    Comment


                    • #40
                      It does have to do with that, I did some tests last night and confirmed what has already been said, the script I posted to override xrefs does not work correctly with xrefs.

                      I can get around this by having a transparent script run before each render to update the xrefs before the render frame, no guarentees but I'm 95% sure it would work.

                      dbuchhofer - XRefs are handy if you use a global override for the scene in which the xrefs will be overridden as well, however this method is easier to setup, but allows for less control over the final matte pass.

                      I am unable to completely forsee how this will be used and what functionality should be added, so we'll take it one step at a time and I will quickly add buttons and helpers to expedite the mattepass process, which admittedly is a bit painful.

                      -Colin
                      Colin Senner

                      Comment


                      • #41
                        Originally posted by gilpo View Post
                        Does it have anything to do with Max not updating the XRefs when it opens them during a network render? Is there anyway to force it to do so?

                        The only way I've found to get it to update them is to have there be an atmospheric effect of some kind (like fire) in the file to be xref'ed in. Then it will update them.

                        I appreciate your work on this as I'm sure it will come in very handy. When you're done, I'll lobby for my boss to send you some $$ for your hard work. No guarantees, though.
                        Ill try the same, but no guarantees here either!

                        Cant wait to try!

                        Comment


                        • #42
                          No worries, I hope many of our scripts written here (by lele and others) are used daily to save you all time and money like it does for us! That's the goal. Continue helping me refine my renders and I'll do the same automating some of the more mundane tasks in our 3d program of choice.

                          -Colin
                          Colin Senner

                          Comment


                          • #43
                            Hows it going Colin? I find myself at a loose end today, thought I could start testing for you?

                            Cheers

                            Comment


                            • #44
                              Going great actually. I'll post where I'm at, but it doesn't include xref support yet.

                              PLEASE NOTE: This is not final, but you may test with it

                              Code:
                              -- Rollouts
                              global rlt_MPManager
                              -- Functions
                              global loadRolloutPosition
                              global saveRolloutPosition
                              global loadLayerListBox
                              global MPMsetupMattePass
                              global resetMatteObjects
                              -- Variables
                              global selectedLayerNameArray = #()
                              global MPManagerINIFile = (getDir #scripts + "\\MPManager.ini")
                              global AlphaContribution = -1.0
                              global Shadows = false
                              global AffectAlpha = false
                              global Brightness = 1.0
                              global ReflectionAmt = 1.0
                              global RefractionAmt = 1.0
                              global GIAmt = 1.0
                              global noGI = true
                              global overrideWrappers = false
                              global overrideXRefs = true
                              
                              if (rlt_MPManager != undefined) then destroyDialog rlt_MPManager
                              /**************************************************************************************************************/
                              /* loadRolloutPosition -- loads the ini file and sets the position of the rollout*/
                              fn loadRolloutPosition theRlt theINIFile = (
                                  if (doesFileExist theINIFile) and (hasINISetting theINIFile theRlt.name "pos_x") and (hasINISetting theINIFile theRlt.name "pos_y") then (
                                      local thePos = point2 0 0
                                      thePos.x = (getINISetting theINIFile theRlt.name "pos_x") as float
                                      thePos.y = (getINISetting theINIFile theRlt.name "pos_y") as float
                                      setDialogPos theRlt thePos
                                  ) else (    -- ini file doesn't exist, create it
                                      saveRolloutPosition theRlt theINIFile
                                  )
                              )
                              
                              /* saveRolloutPosition -- saves the position of the rollout in the ini file */
                              fn saveRolloutPosition theRlt theINIFile = (
                                  local thePos = getDialogPos theRlt
                                  try (
                                      setINISetting theINIFile theRlt.name "pos_x" (thePos.x as string)
                                      setINISetting theINIFile theRlt.name "pos_y" (thePos.y as string)
                                  ) catch ( messageBox ("Unable to write correctly to the file "+theINIFile+".") beep:false )
                              )
                              
                              /*    MPMsetupMattePass */
                              /*     theLayerNames    - String variable with the layer names separated by semicolons, to create a matte pass for the layer "People" and "Trees" pass "People;Trees" to this variable */
                              /*    oVRayMtlWrapper        - [True/False] turning this on will override all VRayMtlWrapper to matte settings if they are assigned to a matte layer
                                  options             - Array variable of options you can pass to set the matte options in this order [min/max]:
                                                          AlphaContribution: [-1.0 / 1.0]
                                                          Shadows: [true/false]
                                                          AffectAlpha: [true/false]
                                                          Brightness: [0/1.0]
                                                          ReflectionAmt: [0/1.0]
                                                          RefractionAmt: [0/1.0]
                                                          GIAmt: [0/1.0]
                                                          noGI: [true/false]
                                                          
                                                          To set a matte pass for the layer "People" using an Alpha contribution of -1.0, Direct light Shadows to true pass this to MPMsetupMattePass
                                                          MPMsetupMattePass "People" options:#(-1,true,false,1,1,1,1,true)
                              */
                              fn MPMsetupMattePass theLayerNames oVRayMtlWrapper:false options:#(AlphaContribution,Shadows,AffectAlpha,Brightness,ReflectionAmt,RefractionAmt,GIAmt,noGI) = (
                                  if (theLayerNames != "") and (theLayerNames != undefined) then (
                                      local layerNamesArr = filterString theLayerNames ";"
                                      local matteObjectsArr = #()
                                      local nonMatteObjectsArr = #()
                              
                                      /* Separates the objects into two arrays for the matte objects and non matte objects */
                                      for o in objects do (
                                          for l in layerNamesArr where (l != "") and (l != undefined) do (
                                              if (o.layer.name == l) then
                                                  append nonMatteObjectsArr o
                                              else
                                                  append matteObjectsArr o
                                          )
                                      ) /* done separating */
                                      
                                      /* Set matte objects */
                                      for o in matteObjectsArr do (
                                          setUserProp o "VRay_Matte_Enable" on
                                          setUserProp o "VRay_Matte_Alpha" options[1]
                                          setUserProp o "VRay_Matte_Shadows" options[2]
                                          setUserProp o "VRay_Matte_ShadowAlpha" options[3]
                                          setUserProp o "VRay_Matte_ShadowBrightness" options[4]
                                          setUserProp o "VRay_Matte_ReflectionAmount" options[5]
                                          setUserProp o "VRay_Matte_RefractionAmount" options[6]
                                          setUserProp o "VRay_Matte_GIAmount" options[7]
                                          setUserProp o "VRay_Matte_GI_OtherMattes" options[8]
                                      ) /* done setting up matte objects */
                                      
                                      /* Set non matte objects */
                                      resetMatteObjects nonMatteObjectsArr
                              
                                      /* Set VRayMtlWrappers to matte objects if true */
                                      if oVRayMtlWrapper then (
                              /*            local mtlWrapper = getClassInstances VRayMtlWrapper    -- Array of MtlWrapper materials on the objects
                                          for i = 1 to mtlWrapper.count do (
                                              local geoMtls = for d in (refs.dependents mtlWrapper[i]) where (isKindOf d GeometryClass) or (isKindOf d Shape) collect d
                              
                                              for o in matteObjectsArr do (
                                                  for j in geoMtls do (
                                                      if (idx = findItem matteObjectsArr j) != 0 then (
                                                          
                                                      )
                                                  )
                                              )
                                          )
                              */
                                      )
                                      
                                      
                                      
                                  ) else print "Please specify the Layer Names to generate a matte pass."
                              )
                              
                              /* Resets all objects to the default VRayProperties */
                              fn resetMatteObjects objArr = (
                                  for o in objArr do (
                                      setUserProp o "VRay_Matte_Enable" off
                                      setUserProp o "VRay_Matte_Alpha" 1.0
                                      setUserProp o "VRay_Matte_Shadows" off
                                      setUserProp o "VRay_Matte_ShadowAlpha" off
                                      setUserProp o "VRay_Matte_ShadowBrightness" 1.0
                                      setUserProp o "VRay_Matte_ReflectionAmount" 1.0
                                      setUserProp o "VRay_Matte_RefractionAmount" 1.0
                                      setUserProp o "VRay_Matte_GIAmount" 1.0
                                      setUserProp o "VRay_Matte_GI_OtherMattes" true
                                  )
                              )
                              /************************************************************************************************************/
                              
                              rollout rlt_MPManager "MPManager v1.0" (
                                  multiListBox mlst_Layers "Layers of non-Matte objects:" items:#() height:17 width:160 offset:[0,5]
                                  
                                  groupBox grp_MatteProperties "Matte object properties" width:180 height:240 offset:[170,-247]
                                  spinner spn_alphaContribution "Alpha Contribution  " range:[-1,1,-1] type:#float fieldWidth:35 offset:[-7,-224]
                                  
                                  groupBox grp_DirectLight "Direct light" width:160 height:80 offset:[180,0]
                                  checkbox chk_Shadows "" offset:[310,-70]
                                  label lbl_Shadows "Shadows" offset:[104,-19]
                                  checkbox chk_AffectAlpha "" offset:[310,0]
                                  label lbl_AffectAlpha "Affect Alpha" offset:[97,-19]
                                  spinner spn_brightness "Brightness  " range:[0,1,1] type:#float fieldWidth:35 offset:[-14,2]
                                  
                                  groupBox grp_RRGI "Reflection/Refraction/GI" width:160 height:110 offset:[180,6]
                                  spinner spn_reflection "Reflection Amount " range:[0,1,1] type:#float fieldWidth:35 offset:[-15,-94]
                                  spinner spn_refraction "Refraction Amount " range:[0,1,1] type:#float fieldWidth:35 offset:[-15,0]
                                  spinner spn_gi "GI Amount " range:[0,1,1] type:#float fieldWidth:35 offset:[-15,0]
                                  label lbl_noGI "No GI on other mattes" offset:[80,0]
                                  checkbox chk_noGI "" offset:[312,-17] checked:true
                                  
                                  --groupBox grp_Setup "Setup" offset:[0,17] width:130 height:50
                                  checkBox chk_oVRayMtlWrapper "Override VRayOverrideMtls to Matte" offset:[0,19] enabled:false
                                  checkBox chk_oXRefs "Override XRefs" checked:overrideXRefs enabled:false
                                  
                                  button btn_Setup "Setup Matte Pass" offset:[0,5] align:#left
                                  button btn_Reset "Reset Pass" offset:[-30,-27] 
                                  
                                  fn loadLayerListBox = (
                                      theItems = for i=0 to layerManager.count-1 collect (layerManager.getLayer i).name
                                      mlst_Layers.items = theItems
                                  )
                              
                                  fn updateSelectedLayerNameArray = (
                                      local layersSel = mlst_Layers.selection as array
                                      selectedLayerNameArray = for i = 1 to layersSel.count collect mlst_Layers.items[layersSel[i]]    
                                  )
                                  
                                  on btn_Setup pressed do (
                                      local selectedLayerNameAsString = ""
                                      updateSelectedLayerNameArray()
                                      
                                      -- Separates the Array into strings to pass to MPMsetupMattePass
                                      for l in selectedLayerNameArray do selectedLayerNameAsString += (l + ";")
                              
                                      MPMsetupMattePass selectedLayerNameAsString oVRayMtlWrapper:overrideWrappers options:#(AlphaContribution,Shadows,AffectAlpha,Brightness,ReflectionAmt,RefractionAmt,GIAmt,noGI)
                                  )
                                  
                                  on btn_Reset pressed do (
                                      resetMatteObjects objects
                                  )
                                  
                                  on spn_alphaContribution changed val do AlphaContribution = val
                                  on chk_Shadows changed state do Shadows = state
                                  on chk_AffectAlpha changed state do AffectAlpha = state
                                  on spn_brightness changed val do Brightness = val
                                  on spn_reflection changed val do ReflectionAmt = val
                                  on spn_refraction changed val do RefractionAmt = val
                                  on spn_gi changed val do GIAmt = val
                                  on chk_noGI changed state do noGI = state
                                  on chk_oVRayMtlWrapper changed state do overrideWrappers = state
                                  on chk_oXRefs changed state do overrideXRefs = state
                                  
                                  on rlt_MPManager open do (
                                      clearListener()
                                      loadRolloutPosition rlt_MPManager MPManagerINIFile
                                      print "MPManager Loaded..."
                                      loadLayerListBox()
                                  )
                                  
                                  on rlt_MPManager close do (
                                      saveRolloutPosition rlt_MPManager MPManagerINIFile
                                  )
                              )
                              createDialog rlt_MPManager 373 335
                              Paste the script into a new script via "MAXScript->New Script" and evaluate all (ctrl-e)

                              -Colin
                              Colin Senner

                              Comment


                              • #45
                                Nice, had a test over the weekend, and it seems to work well.

                                I like the dialogue, but am still concerned about the layers verses xref. I guess as long as both options are included, its up to the user to deside how to best fit it in to their workflow. For me, its only xref. I can't rely on others sticking to layer convensions!

                                Ill test it further on Monday, time permitting, and report back!

                                Thanks, its really coming on.

                                Comment

                                Working...
                                X