Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Frame number padding in 3Ds Max

Frame number padding in 3Ds Max

christian_sodergren
Participant Participant
268 Views
10 Replies
Message 1 of 11

Frame number padding in 3Ds Max

christian_sodergren
Participant
Participant

Hello!

 

A simple question with a hopefully simple answer.

 

How do you set the frame number padding in 3ds max when rendering a sequence of frames?

Some software let you add some ###### representing the padding, but this doesn't work in 3ds max.

 

/Christian

 

@christian_sodergen para una mayor claridad @joaquim.moral ha editado el título original: Frame number padding. Consulta cómo escoger el mejor título para tu post. ¡Gracias por participar!

0 Likes
269 Views
10 Replies
Replies (10)
Message 2 of 11

MartinBeh
Advisor
Advisor

Just enter "image_.png" into the render output field, for example, and 3ds Max will append the frame number to your filename (e.g. image_0000.png, image_0001.png etc.) when rendering a range of frames. That number is padded with zeros to always have four digits. For frame 10000 and above the number will have five (or more) digits with no additional leading zeros.

 

You can also enter "image..png" to get "image.0000.png", for example.

 

What output format do you need?

Martin B   EESignature
→ please 'Like' posts that are helpful; if a post answers your question please click the "Accept Solution" button.
0 Likes
Message 3 of 11

christian_sodergren
Participant
Participant

Thanks, but that is exactly what I would like to control. I can't have four digits and five digits in the same sequence. It has to be the same number of frame padding everywhere. When I later use the sequence in other software, the sequence will get cut off where the digits go from four to five. Of course I can rename the first 10.000 files with an extra '0' but it would be a lot easier to tell 3ds max to use five or six digits when rendering in the first place just like many other rendering software.

Output is 8 bit png with alpha. I make sequences that are several minutes long in 60 fps.

0 Likes
Message 4 of 11

MartinBeh
Advisor
Advisor

As long as you stay below 2:47 minutes at 60 fps... 😉

But seriously I don't think there is an easy solution in 3ds Max that is better than renaming files (one could use MAXScript with a render callback to instantly rename the last file but is that much better?).

Martin B   EESignature
→ please 'Like' posts that are helpful; if a post answers your question please click the "Accept Solution" button.
0 Likes
Message 5 of 11

christian_sodergren
Participant
Participant

Okay, thanks. Well, renaming it is then. 😅

0 Likes
Message 6 of 11

A娘
Advocate
Advocate

max has a rule that after rendering start , the output path can't be edited , so rename was must 

by a post render callback , renaming can be automatic

some renderer has its # to frames rule , so use other sign is safe than #

the script below can put to startup path , when render done , result would be auto renamed , by default , it use "@" as sign , not rename in sub path , support max 's main output path and vray's raw and split path , the full path should not use sign besides auto frame area

also apply to rename files already exist , no need edit script , just render an empty image to the path 
usage ,set output filename as c:\outputdir\outfilename@@@@@@.png,after rendering , the main output will be c:\outputdir\outfilename@@@@@@1234.png , the script will rename it to c:\outputdir\outfilename001234.png,the default element will be c:\outputdir\outfilename@@@@@@_Object ID1234.png , then  c:\outputdir\outfilename_Object ID001234.png , when use vray split , c:\outputdir\outfilename@@@@@@.VRayObjectID.1234.png will be c:\outputdir\outfilename.VRayObjectID.001234.png

fn AEI_ResetFrame =
(
	sign = "@"
	outputpath=#()
	if rendOutputFilename.count > 6 then
		append outputpath rendOutputFilename
	if isproperty renderers.current #output_splitfilename and renderers.current.output_splitfilename.count > 6 do
		append outputpath renderers.current.output_splitfilename
	if isproperty renderers.current #output_rawFileName and renderers.current.output_rawFileName.count > 6 do
		append outputpath renderers.current.output_rawFileName
	for p in outputpath do
		for f in getfiles (getFilenamePath  p +"\\*" +  getFilenameType p) recurse:false do -- if save in split sub path , set recurse to true , 2014 and higher
		(
			-- main output
			fileinfo = (dotNetClass "System.Text.RegularExpressions.Regex").match f  ("^(.*?)("+sign+"+)(\d+)(\.[^.]+)$")
			if fileinfo.Success then
			(
				if fileinfo.Groups.item[2].length >= fileinfo.Groups.item[3].length then
				(
					padding = "000000" +  fileinfo.Groups.item[3].value
					padding = substring padding (padding.count - fileinfo.Groups.item[2].length + 1) -1
					newfile = fileinfo.Groups.item[1].value + padding + fileinfo.Groups.item[4].value
					format "Reset result : % - - % --> %\r\n" (renamefile f newfile) f newfile
				)else
					format "Cancel reset frame from %%%% because of length of % less than existing padding length : %\r\n" sign sign sign sign sign f
			)else
			(
				-- split output
				fileinfo = (dotNetClass "System.Text.RegularExpressions.Regex").match f ("^(.*?)("+sign+"+)(.*?)(\.{0,1})(\d+)(\.[^.]+)$")
				if fileinfo.Success then
				(
					if fileinfo.Groups.item[2].length >= fileinfo.Groups.item[5].length then
					(
						padding = "000000" +  fileinfo.Groups.item[5].value
						padding = substring padding (padding.count - fileinfo.Groups.item[2].length + 1) -1
						newfile = fileinfo.Groups.item[1].value + fileinfo.Groups.item[3].value + fileinfo.Groups.item[4].value + padding + fileinfo.Groups.item[6].value
						format "Reset result : % - - % --> %\r\n" (renamefile f newfile) f newfile
					)else
						format "Cancel reset frame from %%%% because of length of % less than existing padding length : %\r\n" sign sign sign sign sign f
				)else
					format "Can not reset frame from %%%% : %\r\n" sign sign sign sign f
			)
		)
	print "Reset done"
)
callbacks.removeScripts #postRender  id:#AEI_ResetFrame
callbacks.addScript #postRender "AEI_ResetFrame()" id:#AEI_ResetFrame

 

 

0 Likes
Message 7 of 11

CAMedeck
Advisor
Advisor

Would it be possible to string together two separate sequences?  I'm just envisioning using Adobe After Effects and creating one sequence of the 4 digit frames and another of the 5 digit frames, then butting the ends together to force them into a single long sequence.

Chris Medeck
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 8 of 11

christian_sodergren
Participant
Participant

Hello!

Actually after effects can handle sequences with different frame number padding, but some software that I use do not. Typically that software has no GUI and just want a path to the sequence and is not that "intelligent" to understand to continue the sequence when it go from 4 to 5 digits. So there is no option to do anything else. 

 

Easiest would still be for Autodesk to add this small very useful feature in the render settings. Or at least go from 4 digits to 6 as default to make sure that the rendered sequences can be used by other software.. 😉

0 Likes
Message 9 of 11

christian_sodergren
Participant
Participant

Wow! Thanks!

0 Likes
Message 10 of 11

CAMedeck
Advisor
Advisor

For me, and many other users, 6 digits would be major overkill so I'd rather not have the default that long.  🙂

 

When rendering with V-Ray, there is an option to expand # to frame number when saving through the V-Ray Frame Buffer.

CAMedeck_0-1757600449179.png

So what you want is POSSIBLE, it would just need to be implemented by Autodesk.

Chris Medeck
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 11 of 11

A娘
Advocate
Advocate

When rendering with V-Ray, there is an option to expand # to frame number when saving through the V-Ray Frame Buffer.

CAMedeck_0-1757600449179.png


vray's expand # was set # as the padding number what max will set , every # will be set a 4/5 number , when set ##### ,there will be a very long number padding 

0 Likes