Hey all!
I'm trying to render out a scene in max to a specific frame size 1600 x 45 pixels.
My problem is getting the mesh in max to fit to the specified render area. I tried using the zoom extents button but that doesn't fit the specified window. Anyone know of a quick way to get a scene in max to fit a specific sized render area?
Thanks!
Replies
just a question why the strange resolution?
Yeah, the Z key is the same as Zoom Extents and I've already got safe frame on. I need it to match exactly not just closely.
The reason for the strange resolution is because I often use max to make animations for web related purposes.
Anyone else know how to render only the selected objects exactly to a specified resolution?
here is a snippet I once wrote for someone that asked me how to create a cone that matches the camera with a pre- defined height. you could change the equation and with that calculate the distance the camera would need to be placed away from the object. Meaning that the width of your object is your input value and the distance between the camera and the object is the value to compute.
Btw. is you camera aligned orthogonal or is it always freestyle perspective? - I rather assume its ortho so meaning that the camera probably is aligned on a axis or 2 with the object and that it just gets moved away to fit the object.
I actually just figured out a "good enough" fix by using the render region and then auto region to selected options in the render window. Its off by a single pixel around the entire object so its easy enough for me to crop later. I just wish there was a way to manually input numbers and have max auto fit to the size of the mesh provided they're the same.
I know my way around max fairly well, but not enough to use scripting. Thanks for the suggestion anyway though, it'd probably work but I don't think I could manage it so for now I'll have to live with the 1 pixel margin of error.
Thanks for the quick response though.
Trying again with a target camera...
I am already fiddling a script...
I actually managed to get it to work though by simply creating a target camera moving the camera and target to absolute 0 (along with the scene) and then simply sliding the camera back to whatever looked like it was pretty close and then adjusting the numbers numerically until the bright red background color that I used disappeared.
Bit of a pain, but at least it worked.
see the bounding box of the teapd? - it fits perfectly in the safe frame of the camera
here is the script:
running scripts in max is actually quite easy, simply hit [F11] to open up the maxscript listener - you get some console popping up. From there select
File > New Script
a new script window will appear, paste my script in it and hit [ctrl] + [e] to run it (it maxscript terms evaluate, alternativly you can find it either under file > evalzuate or in max 2009+ under tools > evaluate).
the current script assumes that your projection direction of the camera is the same as the front view of max. If you need it from another axis (e.g top view behaviour) the ".x" related stuff needs to be changed (defines the width). Same for the ".y" camera related stuff.
Thanks a million for your help man!
this is roughly how the code works:
1.) generates a temp variable for the camera and the reference object
2.) loops through your selection (I just assume that you only selected those 2 objects)
3.) within the selection check which one is the camera and which is the other one. If it is the object already calculate it's width of the bounding box (actually just 1/2 of see the illustration I made before)
4.) after that I use trigonometry to calculate the height of the triangle (the distance between surface of the object and the camera position) - and apply it to the camera .y position. The
"obj_source.min.y" actually represents the outer position of the bounding box of your object (so no the center of the object which is propably the default with your pivot).
some time ago I wrote a script to get and set Editable Poly and Mesh dimensions in screen space, relative to active viewport. You can get "IC.SizeInScreen" in MaxScript page of IllusionCatalyst website.