PDA

View Full Version : Is it possible to change a mesh at render time.


erilaz
03-26-2006, 10:08 PM
I've been going over the #preRenderFrame callbacks and it explicitly says you cannot change a mesh during render time, due to it caching the mesh beforehand. Is there actually a way around this, short of scripting it to render sequentially one frame at a time?

j-man
03-28-2006, 08:27 AM
Hello Martin,

What exactly are you trying to change? it is possible but you need to remember that changes you do for one frame are going to be there for the next! I was experimenting with this the other day and found a few hurdles to get over.
Firstly, can you do the first frame with #prerendereval and then all subsequent frames with #postrenderframe ?

J.

erilaz
03-28-2006, 09:26 PM
I'm pretty much changing the mesh every frame. What I've made is a timer object that changes the text object (which is shelled) as it counts down, like so:

6:00
5:59
5:58

etc.

The problem is, you can't use prerender or postrender in this sitatuion, because it takes a pointer the initial mesh (in this case the text with 6:00).
At this stage I've had to write my own frame-range script to actually render each frame seperately and incrementally, which works fine. I had to throw a gc() in per frame though, because the memory was skyrocketing!!!

JHaywood
03-28-2006, 10:54 PM
Yep, that's what I've had to do in this type of situation also. Here's the script I use, nothing amazing but it gets the job done:

fn zeroPad num = (
local n = num as string
if num >= 0 and num < 10 then ("000" + n)
else if num > 9 and num < 100 then ("00" + n)
else if num > 99 and num < 1000 then ("0" + n)
else n
)

renderSceneDialog.commit()
if rendOutputFilename == "" then messagebox "Enter a file name in the Render Output section of the Render dialog box."
else (
totalFrames = ((animationRange.end - animationRange.start) as integer) * framerate / 4800
escapeEnable = true
progressStart "Rendering..."
for i = animationRange.start to animationRange.end do (
sliderTime = i
n = zeroPad (i as integer / 160)
render vfb:false outputFile:((getFilenamePath rendOutputFilename) + (getFilenameFile rendOutputFilename) + n + (getFilenameType rendOutputFilename))
progressUpdate (100.0 * i / totalFrames )
if getProgressCancel() do exit
)
progressEnd()
)

j-man
03-29-2006, 12:44 PM
I usually put a script controller on the text kerning parameter (under a list controll so I can still modify the kerning if I want!) That way the text is calculated every frame.


CGTalk Moderation
03-29-2006, 12:44 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.