AWS Thinkbox Discussion Forums

Vray lightcache prerender in RPM

Hi Deadline masters! I’m trying to create a basic script to submit Vray LC + Vray Render (similar to this one) thru RPManager but I get stuck.

Can anyone help me with that, please?

This is what i’ve made/copied so far:

(--start local scope
	
	SelectedPass = RPMdata.GetPassSelection()
	RmanBuildOutputs.autoBuildPaths(SelectedPass)
	RPMdata.updateUI()	
	
--If SMTD has not been opened yet, or has been closed since the start of 3ds Max, launch its UI:
--if SMTD_MainRollout == undefined do macros.run "DeadlineRPM" "SubmitMaxToDeadlineRPM" 

local theRenderer = renderers.current							--get the current renderer
if isKindOf theRenderer VRay do									--if it is VRay, we are good to go
(
	--Render final image is disabled, light cache is set to render in the output dir
	local oldRenderDialogState = renderSceneDialog.isopen()		--see if the render dialog was open
	renderSceneDialog.close()									--close it before submission
	rendSaveFile = false										--disable output file saving
	theRenderer.options_dontRenderImage = true					--disable the rendering
	local lcpath = getFileNamePath rendOutputFilename + getFileNameFile rendOutputFilename + ".vrlmap"	--build the LC path name
	theRenderer.lightcache_autoSave = true						--enable LC auto-save 
	theRenderer.lightcache_autoSaveFileName = lcpath			--and set the file name to the cache path
	
	--Handle Region Rendering - LC Job should always be full frame
	local oldRegionMode = SMTDSettings.RegionRenderingMode		--store whatever Region mode SMTD was in
	SMTDSettings.RegionRenderingMode = #none					--and force full frame submission
	
	--Job sends to deadline
	::SMTDIsCurrentlySubmitting = true							--raise the flag showing we started submission and it is not canceled
	SMTDSettings.PreviousJobsArray = #() 						--clear the dependencies list
	SMTDSettings.SubmitAsDependent = false 						--disable dependencies for first job submission

	SMTD_MainRollout.getNameFromMaxScene()						--update the job name in the UI
	local oldJobName = SMTDSettings.JobName 					--store the current job name
	SMTDSettings.JobName = oldJobName+" [VRay LC]"				--set the LC job's name
	local batchName = oldJobName + " [VRay LC + Render]"		--a batch name to combine the two jobs
	local result = SMTDFunctions.SubmitJobFromUI batchName:batchName		--submit the job to Deadline as part of the batch

	SMTDSettings.RegionRenderingMode = #singleFrameTiles --switch to tile mode
	SMTDSettings.TilesInX = 1 --number of tile columns
	SMTDSettings.TilesInY = 30 --number of tile rows
	TilesPadding = 0 --whatever padding you want to use
	SMTDSettings.SingleTileJobDependent = true --submit a dependent Draft Tile Assembly job

	
	if SMTDSettings.PreviousJobsArray.count > 0 do				--if a previous job exists to depend on,
	(
		--Render final image is enabled, lc is switched to "from file" and uses the precalced light cache 
		rendSaveFile = true										--re-enable output file saving
		theRenderer.options_dontRenderImage = false				--re-enable rendering 
		theRenderer.lightcache_autoSave = false					--disable the auto save mode
		local old_lightcache_mode = theRenderer.lightcache_mode	--store the old mode
		theRenderer.lightcache_mode = 2							--set LC mode to From File
		theRenderer.lightcache_loadFileName = lcpath			--set the load file to the cached path from the previous submission

		--Job sends to deadline with the first as a dependency.
		SMTDSettings.SubmitAsDependent = true					--enable dependencies
		SMTDSettings.DependencyJobItems = #{1}					--set the dependency on the first entry from the list
		SMTDSettings.DependOnPreviousJobMode = #last			--set the mode to last, so only the last job is concidered
		SMTDSettings.JobName = oldJobName+" [VRay Render]"		--set the job name
		SMTDFunctions.SubmitJobFromUI batchName:batchName		--submit to Deadline as part of the same batch

		SMTDSettings.JobName = oldJobName						--restore the job name
		SMTDSettings.SubmitAsDependent = false					--disable dependencies
		SMTDSettings.DependencyJobItems = #{}					--and clear the dependency jobs bitarray flags
		theRenderer.lightcache_mode	= old_lightcache_mode 		--restore the old cache mode
	)
	::SMTDIsCurrentlySubmitting = undefined						--lower the cancel submission flag since we are done
	if oldRenderDialogState do renderSceneDialog.open() 		--reopen the render dialog if needed
)--end if
)--end local scope

The main issue here is that RPManager is not updating the output path in render output and when I use RPMrendSubmit.netsubmit command it overrides the custom submission script.

Privacy | Site terms | Cookie preferences