Notifications
Clear all

[Closed] Light per pass with RPM and VRay

Anyone use both RPM and VRay?

This will create one pass per light in the scene but I’m having problems with VRaySun and with the VRaySun in a Daylight assembly head.

if not rmpasses.open do RPMdata.RMopenFloater()
 
 global allLights = #()
 
 for a in lights where classof a != Targetobject do --and classof a != objectset 
 	(
 		append allLights a
 	)
 
 global existPasses = RPMdata.GetPassCount() --store the existing number of passes
 ("PassCount:" + existPasses as string)
 
 capSet = RPMCaptureProps.createCaptureObjectSet() -- create a new capture set. Would like to add the Name at this point
 
 lightCapture = RPMCaptureProps.getMyPropDefinitions lightinputarray:#("On") --Define the properties
 
 RPMCaptureProps.assignCaptureProperties #(1) lightCapture --Assign the properties to the capture set. Would like to use the appropriate index here if there were existing CaptureSets
 RPMCaptureProps.addObjectsToSet 1 allLights suppressProgress:false -- Add all the lights to the CapSet
 
 --Build a pass for each light
 for i = 1 to allLights.count do
 (
 	lightname = allLights[i].name
 	RPMdata.AddPassSetup setname:lightname noEdit:true
 	
 	--turn off all lights
 	for k = 1 to allLights.count do 
 	(
 		if (hasproperty allLights[k] "enabled") then allLights[k].enabled = false
 		else if (hasproperty allLights[k][2] "enabled") then allLights[k][2].enabled = false
 			else allLights[k].on = false 
 	)
 
 	--turn on the corrisponding Light
 	if (hasproperty allLights[i] "enabled") then allLights[i].enabled = true
 		else if (hasproperty allLights[i][2] "enabled") then allLights[i][2].enabled = true
 			else allLights[i].on = true 
 	
 	RPMCaptureProps.OPcapture_object allLights
 )
 
 rmpasses.close()
 RPMdata.RMopenFloater() 
1 Reply

for anyone interested Grant from RPM sorted it out for me. The propper script is here:

if not rmpasses.open do RPMdata.RMopenFloater()
  
  global allLights = #()
  
  for a in lights where classof a != Targetobject do
  	(
  		append allLights a
  	)
  
  global existPasses = RPMdata.GetPassCount() --store the existing number of passes
  print ("PassCount:" + existPasses as string)
  
  haveCreatedLightSet = false;
  
  --Build a pass for each light
  for i = 1 to allLights.count do
  (
  	lightname = allLights[i].name
      RPMdata.AddPassSetup setname:lightname noEdit:true force:true -- the force stops it asking about creating a camera
  	if haveCreatedLightSet == false do -- if we call these before a pass is created it errors.
  	(
  		-- assume there is only one
  		capSet = RPMCaptureProps.createCaptureObjectSet() -- create a new capture set. Would like to add the Name at this point
  		RPMCaptureProps.setCapSetName (RPMCaptureProps.getnumcapsets()) "Lights"
  		lightCapture = RPMCaptureProps.getMyPropDefinitions lightinputarray:#("On") custominputarray:#("enabled")--Define the properties
  		-- work around the problem that the last call didn't actually do what it should have and add the supplied custom property:
  		lightCapture[7] = #("enabled")
  		RPMCaptureProps.assignCaptureProperties #(RPMCaptureProps.getnumcapsets()) lightCapture --Assign the properties to the capture set. Would like to use the appropriate index here if there were existing CaptureSets
  		RPMCaptureProps.addObjectsToSet (RPMCaptureProps.getnumcapsets()) allLights suppressProgress:false -- Add all the lights to the CapSet
  		haveCreatedLightSet = true;
  	)
  	for k = 1 to allLights.count do --turn off all lights
  		(
  		if isproperty allLights[k] #on then (
  			allLights[k].on = false --turn on the corrisponding Light
  		)
  		else if isproperty allLights[k] #enabled do(
  			allLights[k].enabled = false --turn on the corrisponding Light
  		)
  	)
  	
  	if isproperty allLights[i] #on then (
  		allLights[i].on = true --turn on the corrisponding Light
  	)
  	else if isproperty allLights[i] #enabled do(
  		allLights[i].enabled = true --turn on the corrisponding Light
  	)
  	RPMCaptureProps.OPcapture_object allLights
  )
  
  rmpasses.close()
  RPMdata.RMopenFloater()