Notifications
Clear all

[Closed] Offset Numbering of Rendered Frames

Hello. I have a situation – I have to render 2 sequences starting and ending on different frames. It’s for animation for a game. On the same scene the character is doing the same animation for 2 sides. For example: drinking_R and drinking_L. From frame 0 to frame 15 he is turned to right and from frame 16 to frame 31 he is turned to left and doing the same animation – drinking (biped). I’ve previously made a script for this to automate rendering and naming based for a name of animation (which is changing). My problem is when rendering a …png sequence from f0 to f15 the suffix is, by default, 0000 to 0015 and from f16 to f31 the suffix is 0016 to 0031. Is there a way to offset numbering of rendered frames for the sequence starting from f16 to f31 to be the same as the first one – 0000 to 0015? In that case my animation would be like it has to be, for example: drinking_R.0000.png to drinking_R.0015.png and drinking_L.0000.png to drinking_R.0015.png. Right now I’m renaming the numbering after rendered animation using other tools, so I wanted to ask you, guys, If someone know a solution to make that setup in maxscript. The code I’m using is max quick render setup and not Batch for few reasons. Here’s the part of the code for rendering:


fn callRenderR =
(
viewport.setCamera $CAM_2
rendUseActiveView = true
renderWidth = 256
renderHeight = 512
rendTimeType = 3
rendSaveFile = true
rendOutputFilename = drinking_R..png
rendStart = 0
rendEnd = 15
max quick render
)
	
fn callRenderL =
(
viewport.setCamera $CAM_2
rendUseActiveView = true
renderWidth = 256
renderHeight = 512
rendTimeType = 3
rendSaveFile = true
rendOutputFilename = drinking_L..png
rendStart = 16
rendEnd = 31
max quick render
)

callRenderR()
callRenderL()
3 Replies

you could use #postRenderFrame callback and rename saved file

 renameFile <old_filename_string> <new_filename_string> 

I’ve tried to make this work but I’m still stuck This post render frame callback should rename file instantly after rendering it and just before saving it or it renames rendered frame that is just saved in the folder?
here’s the code – no errors but it doesn’t work:

global right = "C:\Users\Filip\Desktop\TestFolder\Right\drinking_R..png"
global left = "C:\Users\Filip\Desktop\TestFolder\Left\drinking_L..png"
global newLeft = "C:\Users\Filip\Desktop\TestFolder\Left\drinking_L.0000.png"
callbacks.removeScripts #postRenderFrame id:#RenameSuffix

fn callRenderR =
(
viewport.setCamera $CAM_2
rendUseActiveView = true
renderWidth = 256
renderHeight = 512
rendTimeType = 3
rendSaveFile = true
rendOutputFilename = right
rendStart = 0
rendEnd = 15
max quick render

)
	
fn callRenderL =
(
viewport.setCamera $CAM_2
rendUseActiveView = true
renderWidth = 256
renderHeight = 512
rendTimeType = 3
rendSaveFile = true
rendOutputFilename = left
rendStart = 16
rendEnd = 31
max quick render
callbacks.addScript #postRenderFrame "renameFile Left newLeft" id:#RenameSuffix	
)

callRenderR()
callRenderL()

I can’t believe I made this so complicated. The solution is: just insert a “rendFileNumberBase = (0 – 16)”
Number 16 is starting point of rendering from that side and negative numbers from 0 to -16 is equivalent to frames that are beginning frame numbers from L side so it converts 0016 to 0000 and so on. Still can’t believe that was just that simple
Sorry for bothering you, guys. Have a nice week. Cheers!