View Full Version : Screenspace to blowup rect

04 April 2012, 05:56 PM
Hi all,

I’ve put together a script to speed up our rendering process in 3dsmax, we use a fixed camera + blowup region to render a region that matches a pre-defined size in either width or height depending on the aspect ratio. Nothing to complicated.

1. The screenspace rect is calculated from all vertex points in the selected meshes. Uses a simple mapWorldToScreen transform, similar to what’s used in the vertex renderer example in the docs.

2. The aspect ratio is defined (based on step 1 and the width/height) and set in render settings.

3. The screenspace rect is transformed to “render pixel space” to form a blowup rect. The aspect ratio is kept.

4. A Box2 scale (from it’s center) is applied to add a white border around the selected objects in the blowup rect.

There is now a blowup rect that surrounds the selected objects in the active viewport.
Finally, the problem is that the screenspace transformation to blowup rect lacks in precision, we often end up with clipped areas and we loose a few pixels depending on viewport/transformation and vertex coordinates. This forces us to either render at a higher resolution with increased scale (step 4) or manually correcting the blowup rect.

Did anyone succeed in writing a “fit selected objects in a blowup” rect script?
If anyone is interested I could share the script, probably useful as the “Auto region selected” option is not really usable.



Also posted on Area:

CGTalk Moderation
04 April 2012, 05:56 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.