PDA

View Full Version : Netrender callbacks


handiklap
10-11-2006, 01:06 PM
I've recently written a couple utilities that aid in netrendering multiple passes that are later composited within max. Previously, the script was a singular solution for one machine, rendering four passes and then compositing those passes. Now I have the passes distributed between a few machines, and then later, after all of them are finished (that is to say, when I can be assured that each of the 4 components of a comp are finished), I then put the output directory through another script which handles the compositing. I'm trying to script a way to tell when the 4 jobs of each image are completed. Right now, each of the jobs uses the same maxscript variable, but of course is submitted with a unique name (a file prefix and a unique suffix for each of the four passes). I've tried using the callbacks for both #message and #update, using the maxscript help examples as models, without success. Here's the code I'm using:

netMgr = netrender.getManager()
netMgr.connect #automatic "255.255.255.0"
if (netMgr.querycontrol #wait) do netMgr.getcontrol()
netMgr.wantControl = true

--[standard pass]
netJob = netMgr.newJob()
netJob.name = ((getFilenameFile rendOutputFilename) + "_std")
netJob.frameOutputName = (rendName + "_std" + ".tif")
netJob.includeMaps = true
netJob.suspended = false
netJob.fromFrame = 0
netJob.toFrame = 0
netJob.notifications = true
netJob.notifycompletion = true
netJob.submit()

holdMaxFile()
--[scene changes here]

--[ambient pass]
netJob = netMgr.newJob()
netJob.name = ((getFilenameFile rendOutputFilename) + "_amb")
netJob.frameOutputName = (rendName + "_amb" + ".tif")
netJob.includeMaps = true
netJob.suspended = false
netJob.fromFrame = 0
netJob.toFrame = 0
netJob.submit()

--[scene changes here]

--[specular pass]
netJob = netMgr.newJob()
netJob.name = ((getFilenameFile rendOutputFilename) + "_spc")
netJob.frameOutputName = (rendName + "_spc" + ".tif")
netJob.includeMaps = true
netJob.suspended = false
netJob.fromFrame = 0
netJob.toFrame = 0
netJob.submit()

--[scene changes here]

--[occlusion pass]
netJob = netMgr.newJob()
netJob.name = ((getFilenameFile rendOutputFilename) + "_occ")
netJob.frameOutputName = (rendName + "_occ" + ".tif")
netJob.includeMaps = true
netJob.suspended = false
netJob.fromFrame = 0
netJob.toFrame = 0
netJob.submit()

fetchMaxFile quiet:true
Looking at it now, I realize I should write a fn with the suffix argument for making unique names for the passes.:rolleyes:

If I could get returns of job name completions, or even have all of the manager output through callbacks to weed out the "Job" prefixes, I could easily tell if the four passes for a particular scene have completed.

Thanks for any pointers.

edit: And a bonus question: What setting am I overlooking that turns off trailing zeros on my netrender output? Everything I render with the above code tacks "0000" to the end of the filename.

antonv
10-11-2006, 03:41 PM
The trailing 0's gave me a lot of headaches. I couldn't find a solution through mxs. There is no function to remove them. I've also tried to add postrender callbacks but they didn't wanted to work over the network...
The solution was to have another machine run a script every few minutes and check the folders for new renders and rename them. I would guess that it would be your best bet too...

This was happening in max7. I haven't tried in 8 with the new scripts thing in the render dialog. That might work now.

Hope this helps!
Anton

handiklap
10-11-2006, 08:56 PM
Yeah, I was hoping there was a simpler way, but I figured I'd have to make something along those lines in the meantime. Like you had suggested, I just made a script that polls the output directory's contents every so often and when it finds what it wants it runs the compositing fn. I guess whether it's ugly or not, it works.

CGTalk Moderation
10-11-2006, 08:56 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.