Hi Bobo,
I’ve been trying to get clever with this submission script, but it’s not working as intended when using the Vray Frame Buffer. Any pointers are appreciated!
What should happen:
Precalc job is sent first with DR slaves.
–This calculates the lightcache file and saves out that vrlmap and temp preview lightcache image in a new folder that is created (_temp\preview.jpg and _temp\jobname.vrlmap) The preview.jpg is specified in the 3dsmax output.
Main tile job is sent
– This loads the vrlmap from the temp folder. Tiles render and are saved into the output dir specified in the Vray Frame Buffer-Split Channels Option
Assembly Job runs
–And everything gets put back together again.
I have it able to make the new temp folder, save the new lightcache into that folder, create the preview.jpg image but then it all falls down and doesn’t render anything useful, just the RGB and Alpha when enabled on the Separate render channels option in the Vray Frame Buffer.
The tile jobs output on Deadline just lists the render elements with a .jpg extension, not exr like the Vray Output.
The end goal of this is to setup some event plugins to email that preview.jpg to the user to check if the lighting looks ok, and to make it easy to delete all the lightcaches/temp files in the _temp folder in one go.
This is my submission script. I’ve commented everything I have added with a (J) so you can see the method to the madness 
[code](–start local scope
–If SMTD has not been opened yet, or has been closed since the start of 3ds Max, launch its UI:
if SMTD_MainRollout == undefined or not SMTD_MainRollout.open do macros.run “Deadline” “SubmitMaxToDeadline”
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
theRenderer.options_dontRenderImage = true --disable the rendering
theRenderer.system_distributedRender =true --turn on dr (J)
--make sure vfb and split files is on otherwise it will error (J)
tempFolder = getFileNamePath theRenderer.output_splitfilename + "_temp" -- specify temp folder (J)
makeDir tempFolder -- make temp folder (J)
rendoutputfilename = tempFolder + "\\" + "preview.jpg" -- set temp 3dsmax output file as a lightcache preview.jpg (J)
rendSaveFile = false --disable 3dsmax output file saving (J)
local lcpath = tempFolder + “\” + getFileNameFile theRenderer.output_splitfilename + “.vrlmap” --build the LC name in the new temp folder (J)
theRenderer.lightcache_autoSave = true --enable LC auto-save
theRenderer.lightcache_autoSaveFileName = lcpath --and set the file name to the cache path
theRenderer.lightcache_saveFileName = lcpath
SMTDSettings.ForceWorkstationMode = false
SMTDSettings.MergeSceneXRefsOnSubmission = false
SMTDSettings.MergeXRefsOnSubmission = false
SMTDSettings.Priority = 99
SMTDSettings.SingleTileJobDraftErrorOnMissing = true
SMTDSettings.SingleTileJobCleanup = true
SMTDSettings.SubmitAsSuspended = true
SMTDSettings.RemovePadding = true --removes 0000 (J)
re = maxOps.GetCurRenderElementMgr() -- turn off render elements to stop the initial dump of 0000 files (J)
re.SetElementsActive false
–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
SMTDSettings.DBR = true --turn on VrayDR (J)
SMTDSettings.DBRUse3dsCmd = true --turn on 3dscmd in deadline (J)
SMTDSettings.DBRServers = 5 --set 5 dr servers (J)
–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 +" (Pre)" --set the LC job’s name
local batchName = oldJobName + " (Render:BF/LC)" --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 = 1 --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 = false --make sure output file saving is off (J)
re = maxOps.GetCurRenderElementMgr() -- turn on render elements to stop the initial dump of 0000 files
re.SetElementsActive true
theRenderer.options_dontRenderImage = false --re-enable rendering
theRenderer.system_distributedRender =false --turn off dr (J)
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
SMTDSettings.DBR = false --turn off VrayDBR (J)
SMTDSettings.DBRUse3dsCmd = false --turn off 3dscmd in deadline (J)
--Job sends to deadline with the first as a dependency.
SMTDSettings.CloseAfterSubmission = true
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+" (Render)" --set the job name
SMTDSettings.Priority = 80
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
try(destroyDialog SMTD_MainRollout)catch() – close the SMTD window
format “%\n” result
)–end if
)–end local scope[/code]
Thanks.