View Full Version : Orthographic camera position
diegocbarboza
08-30-2010, 08:57 PM
Hi, when I change the position of a perspective camera it goes to the right position, but when I try to do it with an orthographic camera it doesn't get to close to my geometry (what I wanted).
For instance, if I use the same value for position and pointAt, the perspective camera is positioned in the center of the geometry, but the orthografic is positioned away from the scene, so I can see a larger part of the geometry (not what I want this time).
Is there any function I should can after setting camera position and pointAt?
Thanks.
mikeheck
08-31-2010, 12:38 AM
Hi, when I change the position of a perspective camera it goes to the right position, but when I try to do it with an orthographic camera it doesn't get to close to my geometry (what I wanted).
For instance, if I use the same value for position and pointAt, the perspective camera is positioned in the center of the geometry, but the orthografic is positioned away from the scene, so I can see a larger part of the geometry (not what I want this time).
Orthographic and perspective cameras are very different animals and you have to take that into account...
A perspective camera sets up a "frustum" (truncated pyramid) shaped view volume. So moving the camera closer to the geometry, by changing the camera's position field, makes objects appear larger on the screen. We call this operation "dolly" because it's analogous to "dollying in" on a movie set. It's not the same as "zoom" which changes the shape of the view volume, i.e. changing the camera's heightAngle field. With a perspective camera, dolly is used much more than zoom, because changing the shape of the view volume corresponds to changing lenses on the camera, for example from wide angle to telephoto.
An orthographic camera sets up a "rectangular box" (cuboid) shaped view volume, defining a parallel projection as opposed to a perspective projection. Because it's a parallel projection, moving the camera closer to the geometry does NOT change the size of the objects on the screen. So the concept of dolly exists for an ortho camera, but effectively doesn't do anything. (Moving the camera sideways or up and down is still meaningful.) To make objects appear larger on the screen with an ortho camera you have to "zoom". Making the view volume narrower by changing the camera's height field makes objects appear larger on the screen.
Does that help?
Note that switching between perspective and orthographic cameras is tricky. For example you cannot guarantee that converting from perspective to orthographic and back to perspective will result in the same heightAngle as you started with. That's why the Open Inventor viewer provides the preserveCameraHeightAngle option. But if you need to tackle this problem I can post some code that works reasonably well.
-Mike
diegocbarboza
09-02-2010, 04:50 PM
I understand. I think I should be working with perspective cameras instead of orthographic.
I posted another question about cameras in this thread (http://www.mc3dviz.com/openinventor-forum/showthread.php?p=837#post837), if you could please help. I created a new one because it's not the same question discussed here.
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.