Announcement

Collapse
No announcement yet.

VRayStereoscopic Helper Script

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

  • VRayStereoscopic Helper Script

    He guys and Dev Team,
    I wrote this quick little script to add a stereoscopic helper to a scene and link it to a camera somewhat logically. It parents it to the camera and links up the eye distance and focus distance parameters to the camera. This makes managing camera selection and keying easier by default. Make a camera selection and run the following code to try it out. Improvements welcome. I think there should ultimately just be a simple stereoscopic roll-out on the physical camera, where all the stereoscopic parameters can just reside and the helper isn't needed. I presume it is separated because of some weird max back-end stuff.

    Here's the code:
    Code:
    selectedItemsArray = selection as array	
    for i in selectedItemsArray do
     (
      if (SuperclassOf i == camera)then (
    	print ("Camera Found.... proceeding to add a node to "+ i.name +" and link some parameters.")
        --Create Stereo Node
    	VRayStereoscopic isSelected:on
    	$.parent = i
    	in coordsys parent $.pos = [5,0,0]
    	$.rotation.controller = SlaveRotation ()
    	$.name = i.name+"_stereoNode"
    	theStereoNodeName = $.name
    	$.interocular_method = 2
    	$.focus_method = 0
    	$.show_camera_cones = 1
    	the_stereoData = attributes stereoData
    	(
    	 parameters main rollout:stereoParams
    	 (
    	  StereoEyeDistance type:#float Align:#Center  ui:StereoEyeDistanceSpinner default:6.5 Range:[-100,100,6.5]
    	 )
    	 rollout stereoParams "StereoParameters"
    	  (
    		spinner StereoEyeDistanceSpinner "StereoEyeDistance" type: #float
    	  )
    	)
    	custAttributes.add i the_stereoData
    	paramWire.connect2way i.baseObject[#specify_focus] $.baseObject[#specify_focus] "specify_focus" "specify_focus"
    	paramWire.connect2way i.baseObject[#focus_distance] $.baseObject[#focus_distance] "focus_distance" "focus_distance"
    	paramWire.connect2way i.baseObject.stereoData[#StereoEyeDistance] $.baseObject[#eye_distance] "eye_distance" "StereoEyeDistance"
    	
      )else (print "No cameras in selection!")
     )
    I found this helpful and wanted to share.
    -Joel E
    https://www.biglittlepictures.com

  • #2
    So I have found that this, because of the parenting of the stereoscopic camera helper to the camera, actualy doesn't work when distributed rendering. The external buckets are all wrong. Unparenting the helper corrects the problem. Perhaps I will just wire the position and add an offset value.
    Last edited by joelly3d; 27-05-2014, 10:05 AM.
    -Joel E
    https://www.biglittlepictures.com

    Comment


    • #3
      This works better and is error free.
      Code:
      selectedItemsArray = selection as array	
      for i in selectedItemsArray do
       (
        if (SuperclassOf i == camera)then (
      	print ("Camera Found.... proceeding to add a node to "+ i.name +" and link some parameters.")
          --Create Stereo Node
      	VRayStereoscopic isSelected:on
      	iPos = [i.pos.x + 6.5,i.pos.y,i.pos.z]
      	$.pos = iPos
      	$.pos.controller = Position_Constraint ()
      	$.pos.controller.RELATIVE = on
      	$.pos.controller.appendTarget i 100
      	
      	$.rotation.controller = LookAt_Constraint ()
      		$.rotation.controller.upnode_axis = 1
      		$.rotation.controller.target_axis = 2
      		$.rotation.controller.StoUP_axis = 1
      		$.rotation.controller.target_axisFlip = on
      		$.rotation.controller.target_axisFlip = on
      		$.rotation.controller.appendTarget i.target 100
      	$.name = i.name+"_stereoNode"
      	theStereoNodeName = $.name
      	$.interocular_method = 2
      	$.focus_method = 0
      	$.show_camera_cones = 1
      	
      	
      	the_stereoData = attributes stereoData
      	(
      	 parameters main rollout:stereoParams
      	 (
      	  StereoEyeDistance type:#float Align:#Center  ui:StereoEyeDistanceSpinner default:6.5 Range:[-100,100,6.5]
      	 )
      	 rollout stereoParams "StereoParameters"
      	  (
      		spinner StereoEyeDistanceSpinner "StereoEyeDistance" type: #float
      	  )
      	)
      	custAttributes.add i the_stereoData
      	
      	paramWire.connect2way i.baseObject[#specify_focus] $.baseObject[#specify_focus] "specify_focus" "specify_focus"
      	paramWire.connect2way i.baseObject[#focus_distance] $.baseObject[#focus_distance] "focus_distance" "focus_distance"
      	paramWire.connect2way i.baseObject.stereoData[#StereoEyeDistance] $.baseObject[#eye_distance] "eye_distance" "StereoEyeDistance"
      
      
      
      
        )else (print "No cameras in selection!")
       )
      -Joel E
      https://www.biglittlepictures.com

      Comment

      Working...
      X