camera calculations

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
ThePurpleAlien
Posts: 11
Joined: Fri May 15, 2009 4:20 am
Location: Canada

camera calculations

Post by ThePurpleAlien »

I'm trying to setup the camera carefully so that objects on screen have an exact size measurable with a ruler against the screen. I'm calculating field of view based on my screen size and the distance from my eye to the screen.

FOV (in radians) = 2 * atan(0.5 * screen_height / eye_to_screen)

Then I set the distance between the object and the camera so that it should be the correct size on screen. For example, if an object should fill the height of the screen, the distance between the camera and the object should be:

Dist = object_height * eye_to_screen / screen_height

These calculations seem right to me but they don't work out right on screen. One question is whether the irrlicht field of view is horizontal or vertical. Otherwise I don't know what I'm doing wrong. Anyone know how to set these variables up correctly?
Post Reply