Relationship between FOV and aspect ratio..

Hi there, I’m currently trying to make a panoramic camera capture script, in order to capture some really high res landscape aspect images, but I’m stuck at how the horizontal FOV is related to the game aspect ratio.

So, with a camera FOV of 90, and a 1:1 aspect ratio, I get a horizonal angle of 90 degrees, as can be seen in this image:

This is 8 cameras from above, FOV of 90, each rotated 45 degree each time.

However, if I set the game window to 500 x 1000, I’d expect that this would make the horizontal angle of the cameras to be 45 degrees, but the result is slightly larger:

What should the maths behind this be? Ideally what I need to do is work out the current horizontal field of view, from the camera’s FOV and the game window aspect ratio, and then depending on the number of slices, I need to change the game window width to make the camera horizontal angle the correct amount.

So, for example, a 90 degree image with 2 slices, I need to change the game window so that the horizontal field of view ends up at 45, and then I can rotate the camera 22.5 degrees anti clockwise, take the first image, then rotate clockwise 45 degree and take the second image…

Bit stuck, thanks in advance…

FOV is field-of-view angle, so it’s not directly proportional to screen aspect ratio:

tan(FOV/2) = (screenSize/2) / screenPlaneDistance

You can make two equasions:

tan(FOV_H/2) = (screen_width/2) / screenPlaneDistance
tan(FOV_V/2) = (screen_height/2) / screenPlaneDistance

So:

tan(FOV_H/2) / screen_width = tan(FOV_V/2) / screen_height

You should be able to work out what you need from here.