|
Hi all,
In our company (alterface.com) we develop a lot of interactive shooting games. Our 3D artists rely a lot, in Max, on the “auto region selected” feature when rendering a shootable character. Especially if that character is small but moves a lot across the shooting screen: in “auto region selected” mode, Max will automatically set a rendering region around the selected object, and re-adjust that region before rendering each frame, following the object motion across the scene. Which leads to huge rendering time saving.
The problem is that the “auto region selected” mode only works for local rendering, but not in net render mode (backburner).
I tried to overcome that limitation by adding a “#filePostOpen” callback script to my scene, that sets the “auto region selected” mode if the scene is opened in net server mode:
if IsNetServer() then (
format “NetServer mode detected !\n”
format “Setting auto region selected...\n”
setRenderType #regionSelected
)
This *seems* to work, as the “auto region selected” toggle button is shown in the ‘pressed’ state in the rendered frame window, but in practice the rendering is done using the default region (whole output image except 20% borders on each side).
So I tried another approach, computing the region myself from the object’s bounding box (<node>.min and <node>.max) and using a #preRenderFrame callback script to adjust the region at each frame.
Computing the region from the object’s bounding box works well, but the frame-per-frame adjustment shows a one-frame delay: even if I adjust the region just before frame 1 is rendered, the new region is not taken into account for frame 1, but for frame 2.
It looks like Max, before executing the #preRenderFrame callback, takes a private copy of the rendering region pos and size, and uses it for the rendering. So the region adjustment performed by the callback will be taken into account when Max takes a new private copy of the region, before rendering the next frame.
For a multiple frames rendering, I can cheat and adjust the region so as to match “where the object will be at the next frame”. It works fine. But I still have an issue for the first frame in the batch (even if I use an additional #preRender callback in the hope that it will fix the region for the first frame). Given that, in practice, most backburner jobs are 1-frame jobs, it is almost no help at all.
So that’s where I stand… A bit clueless now, I’m afraid. Any fresh ideas? I’d be really grateful if you could help me complete that mission - I’ve grown quite frustrated after all these failures and “almost but not quite” successes… :)
Thanks in advance guys,
Willy
3DSMax2010 SP1
WinXP pro 2002 SP3
|