-
Hi, I want to switch between the two default cameras, but I feel like the orthographic camera is zoomed in out around 120 times more than the default perspective one? Why is that? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
it has a zoom property. i dont know the specifics of the threejs controls so much, you can ask them, but i tend to just set the zoom prop until its close to the perspective cam. |
Beta Was this translation helpful? Give feedback.
-
R3F adjusts the cameras when the canvas pixel size changes, to maintain the aspect. With the orthographic camera, it does this by setting the left/right/top/bottom so that one world space unit projects to one pixel. That's usually more zoomed-out than you want it to be. You can set the zoom property accordingly - it's just a multiplier, so if your whole scene is one world space unit wide and you want it to fit into a 100 px wide viewport, set it to 0.01. With the perspective camera, you instead set the fov, and some simple trigonometry will tell you what to set it to: to get the same stuff visible at the target, keep (right - left) / zoom = tan(fov/2) * distance * 2, where distance is the world-space distance from the camera to the target. |
Beta Was this translation helpful? Give feedback.
it has a zoom property. i dont know the specifics of the threejs controls so much, you can ask them, but i tend to just set the zoom prop until its close to the perspective cam.