Changing to/from vertical/horizontal aperture

Written by Paul Bourke
March 2000

See also: Field of view and focal length

PovRay measures its aperture in the horizontal direction, that is, a camera aperture of 60 is the horizontal field of view. Some other packages (for example OpenGL gluPerspective()) measure their aperture vertically. When converting camera settings from these other applications one needs to compute the corresponding horizontal aperture if one wants the views to match.

It isn't difficult, here's the solution. By calculating the distance from the camera to the center of the screen one gets the following:

height / tan(vaperture/2) = width / tan(haperture/2)

Solving this gives

haperture = 2 atan[ width tan(vaperture/2) / height]

Or going the other way
vaperture = 2 atan[ height tan(haperture/2) / width]

Where width and height are the dimensions of the screen. For example, a camera specification to match an OpenGL camera aperture of 60 degrees might be:

camera {
   location <200,3600,4000>
   up y
   right -width*x/height
   angle 60*1.25293
   sky <0,1,0>
   look_at <200+10000*cos(-clock),3600+2500,4000+10000*sin(-clock)>

Note that the word "aperture", while in common usage in the computer graphics industry, has a very different meaning in the photographic/camera industry. A much better term is "field of view".