I am working on a raytracer at the moment and I come across some issues with the camera model. I just don't seem to manage the calculation of the direction vector of my rays.
Let's say we have given an image resolution of resX x resY, a position pos of the camera, the up vector, the direction vector dir (the direction in which the camera is looking) and a field of view for the horizontal and vertical component fovX and fovY. With the help of these values I can manage to calculate the focal length and thus the width of my pixels.
But when I do the same for the height I'll get another focal length.
There is something I must be missing because the focal length determines the distance between my camera position and the image plane and thus must be unique.
But let's suppose that I've got one unique focal length, then calculating the direction of a ray for the screen coordinates (x,y) should be done with this formula.
I adjust the direction vector in such a way, that he is always in the center of a pixel.
Unfortunately applying this to my raytracer yields absolutely no results.
Edited by StanLee, 13 March 2013 - 10:55 AM.