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

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

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
br0t's picture

I want to render dynamic

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

Never get low & slow & out of ideas

br0t's picture

Ouch, seems I was trying to

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

Never get low & slow & out of ideas

Anubis's picture

Hmm, i was never try this at

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

my recent MAXScripts RSS (archive here)

br0t's picture

But I remove the callback

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

Never get low & slow & out of ideas

Anubis's picture

explanation...

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.

my recent MAXScripts RSS (archive here)

br0t's picture

Thanks Anubis I think I know

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.

Never get low & slow & out of ideas

br0t's picture

:( stuck! If the #postRender

:( 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?

Never get low & slow & out of ideas

Anubis's picture

no :(

what you try to do, share more details.

my recent MAXScripts RSS (archive here)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.