Jump to content
Sign in to follow this  
Crustedink

Camera auto framing

Recommended Posts

Hello,
I am currently trying to build a asset turntable tool, most things are fine, but now i am looking for a way to automatically move the camera for and back in z to make sure, that the framing of the object is good (not too far away and not too close to avoid any clipping).
The camera has no rotation. using the center of the bounding box of my asset as y position and the focal length is also fixed.
whats the best approach to calculate the distance in z ?


thank you for the help!

Edited by Crustedink

Share this post


Link to post
Share on other sites

I'm using this:

(max(bbox(-1,D_ZSIZE),max(bbox(-1,D_XSIZE),bbox(-1,D_YSIZE)))/2)/sin(2*atan((ch("../cam1/aperture")/2)/ch("../cam1/focal"))/2)

bounding box of the render object

Edited by tamagochy

Share this post


Link to post
Share on other sites
21 hours ago, tamagochy said:

I'm using this:


(max(bbox(-1,D_ZSIZE),max(bbox(-1,D_XSIZE),bbox(-1,D_YSIZE)))/2)/sin(2*atan((ch("../cam1/aperture")/2)/ch("../cam1/focal"))/2)

bounding box of the render object

thanks for the reply, sorry for the silly question, but can you explain it a bit further ? so where and how are you using it ?

-//edit
NVM, its workign now. thank you

 

Edited by Crustedink

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×