0
\$\begingroup\$

I have a perspective camera with an fov of 60. It looks at an object from top view with a rotation(90, 0, 0) and position (0, 50, 0)

The user has the option to change the camera to orthographic view to get a 2D view without any depth from top

Now how can i calculate the orthographic size so the view looks same as that in the perspective view(just not having the depth)?

\$\endgroup\$
0
\$\begingroup\$
  size
--------
 \     | d
  \    | i
   \  f| s
    \ o| t
     \v|
      \|

size / distance = tan(fov) using SOHCAHTOA

size = distance * tan(fov)

So the orthographic size should be set to distance * Mathf.Tan(Mathf.Deg2Rad(fov)) where distance is how far away the camera is from the object it's viewing (in your case, I believe 50).

If you know that you won't change the FOV, and/or you know the distance, you can pre-calculate it. For 60 degs and 50 units the orthographic size will be 86.6025403784.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.