Notifications
Clear all

[Closed] Rendering Sub-Frames with Elements

Greetings CG Society,

Longtime reader, first time poster. I’m a maxscipt noob and I need a little help. I’m trying to render an animation on sub-frames for a slowmo effect. In Maya this is a no-brainer, but here in maxscript I’m lost.

I found this post and maxscript from Bobo which is great. http://forums.cgsociety.org/archive/index.php?t-819871.html

(
local cnt = 0 –frame counter, starting on frame 0. Change if desired.
local theBmp = bitmap 640 480 –output resolution
fn getZeros num = –function to return leading zeros
(
num = num as string
substring “000000” 1 (4-num.count)
)
local theStep = 10 –number of sub-frames per frame
for t = 0.0 to 10.0 by 1.0/theStep do –loop from frame 0 to frame 10 with the given step. Change to whatever you want.
(
–generate a frame name with incremeting counter and leading zeros.
local theFilename = getDir #renderoutput + “\test”+ getZeros cnt + cnt as string +”.exr”

--Alternatively, you could save the T variable to get frames named _0.1.exr, _0.2.exr etc. 
--Remove the -- remark below to activate, but keep in mind MAX does not like that format when reading sequences.
--local theFilename = getDir #renderoutput + "\\_test_"+ t as string +".exr"

render frame:t outputfile:theFilename to:theBmp --call the renderer with time, filename and output bitmap
cnt += 1 --increment the counter

)
)

His script works like a charm. I can render out sub-frames no problem. Now when I add a VrayZDepth render element I get stuck. The RGB renders sequentially with filename and number padding perfectly. The zdepth renders only single frame with no number padding. It is actually rendering over that single frame for the entire sequence. I can’t figure out in maxscript how to specify the channel name and number padding and frame increment for rendering the zdepth sequence.

Any help would be greatly appreciated.

Cheers.

1 Reply

The Problem is that you’re only changing the standard outputs filename.

Here is way to change your elements output names, give it a try:

clearlistener()

vr = renderers.current

/*
In case you use "seperate render channels":
vr.output_splitgbuffer = true
vr.output_splitfilename = "YOUR FILENAME HERE"
*/

--- in case you use the standard render elements saving
theManager = maxOps.GetRenderElementMgr #Production

for n = 0 to (theManager.numrenderelements () - 1) do
(
	element = theManager.GetRenderElement n
	theelementoutput = ("path start"+element.elementname+"PLACE YOUR NUMBERING HERE"+".exr")
	theManager.SetRenderElementFilename n theelementoutput
	--print theelementoutput
)