• Create Account

### #ActualStanLee

Posted 13 March 2013 - 10:55 AM

Hello,

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.

### #6StanLee

Posted 13 March 2013 - 10:54 AM

Hello,

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.

### #5StanLee

Posted 13 March 2013 - 10:53 AM

Hello,

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.

http://www.imagebanana.com/view/ysihutsh/fovx.jpg

But when I do the same for the height I'll get another focal length.

http://www.imagebanana.com/view/v041vsp2/fovy.jpg

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.

http://www.imagebanana.com/view/wa3nrteo/formel.jpg

I adjust the direction vector in such a way, that he is always in the center of a pixel.

### #4StanLee

Posted 13 March 2013 - 10:52 AM

Hello,

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.

http://www.imagebanana.com/view/ysihutsh/fovx.jpg

But when I do the same for the height I'll get another focal length.

http://www.imagebanana.com/view/v041vsp2/fovy.jpg

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.

http://www.imagebanana.com/view/wa3nrteo/formel.jpg

I adjust the direction vector in such a way, that he is always in the center of a pixel.

### #3StanLee

Posted 13 March 2013 - 10:52 AM

Hello,

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.

http://www.imagebanana.com/view/ysihutsh/fovx.jpg

But when I do the same for the height I'll get another focal length.

http://www.imagebanana.com/view/v041vsp2/fovy.jpg

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.

http://www.imagebanana.com/view/wa3nrteo/formel.jpg

I adjust the direction vector in such a way, that he is always in the center of a pixel.

### #2StanLee

Posted 13 March 2013 - 10:51 AM

Hello,

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.

http://www.imagebanana.com/view/ysihutsh/fovx.jpg

But when I do the same for the height I'll get another focal length.

http://www.imagebanana.com/view/v041vsp2/fovy.jpg

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.

http://www.imagebanana.com/view/wa3nrteo/formel.jpg

I adjust the direction vector in such a way, that he is always in the center of a pixel.