ScriptSpot

Forum topic · General Scripting

Calling "render()" or "max quick render" from a callback does not work

By br0t · 2011-05-13

Description

Hi,

I am trying to start a new render, after rendering a series of irradiance maps.
I am using this:

callbacks.addScript #postRender "render_animation()" id:#finalAnimation

to start my function which will then adjust some settings in the render scene dialog. That works fine so far, but when I say

render()

at the end of that function I get a
"Unable to open renderer, possible recursion" error message.
When I use

max quick render

instead, just NOTHING happens...

Any ideas :( ?

Comments (8)

br0t · 2011-05-16

I want to render dynamic animations with moving objects, which in Vray is usually done rendering two passes: First an animation prepass that only computes the GI information and saves it as irradiance maps. Second the final rendering pass that loads and interpolates these maps, to avoid flickering.
I want to automate both into one process, so that after rendering the irradiance maps the final rendering starts automatically and no time is wasted (e.g. if you let it run overnight).
But as mentioned if I cannot use the #postRender callback, how does my script know that the rendering of the first pass is finished, so that it can change the rendersettings and start the final render? I really thought this would be a piece of cake :O

Cheers

br0t · 2011-05-16

Ouch, seems I was trying to do it much more complicated and thus overseeing the simple solution. I can just add a second render order after the first one, and it works... Sorry Anubis, thanks for your help :)!


fn renda=
(
	callbacks.removeScripts id:#renda
        --change rendersettings from prepass to final pass
	print "fn call"
)--end fn
 
callbacks.addScript #postRender "renda()" id:#renda

--render prepass:
max quick render

--now the callback is starting the function that adjusts rendersettings
--and when its done, the renderer is free for new calls

--now render final pass:
max quick render

Anubis · 2011-05-13

Hmm, i was never try this at home :)
Imagine if it was work...
you'll put Max in infinity render loops.

br0t · 2011-05-14

But I remove the callback inside the function, so I dont understand why it is still erroring...


fn renda=
(
	callbacks.removeScripts id:#renda
        --change rendersettings here
	print "fn call"
	render()
)--end fn

callbacks.addScript #postRender "renda()" id:#renda
max quick render

explanation...

Anubis · 2011-05-14

Well, am not good in tech explanation but will try.

So, postRender calls start after the rendering finished, but they are the part of the same thread. At this moment the renderer is still "busy" and locked for new calls. Max save rendered image after the postRender end, and then is the end-of-the-thread.

I hope this helps.

br0t · 2011-05-15

Thanks Anubis I think I know what you want to say! How do you know all this stuff :D ? So I guess I need another way for my script to recognize that max has finished rendering.

br0t · 2011-05-15

:( stuck! If the #postRender callback cannot be used, I dont know how to do it. Can I tell Max to wait like a few seconds until the rendering thread has ended, so the renderer is open for new calls?

no :(

Anubis · 2011-05-15

what you try to do, share more details.