Automatically frame object within a camera at an exact size?

   1181   6   1
User Avatar
Member
60 posts
Joined: July 2014
Offline
I have a unique challenge that hopefully someone can help me with.

I am trying to batch render a bunch of objects of different sizes in solaris. I need each object to be in the exact center of the camera and an exact size within the raster of the render. For eg. a render of 2000 x 2000 and the object needs to be 1600 pixels on its largest axis (either width or height). I don't care if I have to scale and re-position the object or if I have to manipulate the camera to achieve the result.

Can anyone suggest a good procedural way to achieve this?

Much appreciated!
User Avatar
Member
900 posts
Joined: Feb. 2016
Offline
You could use the Match Size SOP to scale each object to the 0-1 range. Afterwards, manually adjust the camera to get the object's desired resolution. It might require some trial and error, but you should do it only once.


Or with an orthographic camera, set the orthowidth parameter for framing. Its value indicates the camera view size.
For instance, with an orthowidth of 2 and a camera resolution of 2000, you should adjust your object's size to 1.6 to achieve a width of 1600 pixels in the render.
Edited by Andr - Oct. 31, 2023 06:04:11
User Avatar
Member
60 posts
Joined: July 2014
Offline
Andr
You could use the Match Size SOP to scale each object to the 0-1 range. Afterwards, manually adjust the camera to get the object's desired resolution. It might require some trial and error, but you should do it only once.


Or with an orthographic camera, set the orthowidth parameter for framing. Its value indicates the camera view size.
For instance, with an orthowidth of 2 and a camera resolution of 2000, you should adjust your object's size to 1.6 to achieve a width of 1600 pixels in the render.

The match size doesn't quite give me what I need. It will normalize the scale of the objects within standard x,y,z axis, but it doesn't guarantee that it will be correct from the view of the camera. I need pixel accurate framing of different objects from the view of any given camera.

I'll play around with the orthowidth, thanks for the tip!
User Avatar
Member
34 posts
Joined: Feb. 2016
Offline
Maybe this can help you:
https://www.scantips.com/lights/subjectdistance.html [www.scantips.com]
https://behance.net/derya [behance.net]
User Avatar
Member
8 posts
Joined: Aug. 2017
Offline
You can try with my file.

Attachments:
2000to1600.hip (332.6 KB)

User Avatar
Member
1 posts
Joined: Nov. 2023
Offline
I'll play around with the orthowidth, thanks for the tip!
indigo card [indigocard.ltd]
jjsploit.click
Edited by millerckon - Nov. 9, 2023 07:01:56
User Avatar
Member
60 posts
Joined: July 2014
Offline
jiejia
You can try with my file.

Wow, this is cool! Thank you! This definitely works. I'd prefer not to have to run it through a solver, but it's quite a nice solution!

Some of the limitations here is that it's doing an offset directly in the z axis, so if the camera is not looking directly down z and is rotated differently the offset doesn't work properly. For now, I'm just applying the inverse rotation of my render camera to the geometry and then applying your offset to it, and then rendering from the not rotated camera. Jumping through a few hoops, but at least it solves my problem.

Thanks again!
  • Quick Links