Field of View: Difference between revisions
Jump to navigation
Jump to search
Note: In Source, we work to a percentage of Horizontal FOV because Vertical FOV varies with Aspect Ratio settings. However, the ObjectScale in pixels is the same for both ObjectHeight and ObjectWidth.
(use env_zoom) |
MossyBucket (talk | contribs) (Squeezed in NPC FOV.) |
||
Line 1: | Line 1: | ||
''' | A '''field of view''' (abbreviated '''FOV''') is the maximum angle between the peripherals of a person's or camera's vision. | ||
There are two types of fields of view - one for players and one for [[NPC]]s: | |||
*The player's FOV represents the ''Horizontal Angular Field of View'', determining the angle of a geometrical ''viewwedge'' called a [http://en.wikipedia.org/wiki/Frustrum Frustum], whose rectangular cross-section corresponds to the player's rectangular screen. | |||
*The [[NPC FOV]] instead represents the ''Angular Field of View'', determining the angle of its [[viewcone]]. (You can display [[NPC]] fields of view in-game with the [[Developer Console|console]] command [[npc_viewcone]].) | |||
The | ==The player's FOV== | ||
== | In [[HL2]] the player's ''Horizontal Field of View'' is set to 75 degrees. Screen settings aspect ratios are achieved by cropping the top and bottom of the image (ie reducing the vertical FOV). | ||
You can change this value in two ways: | |||
*By changing the [[Developer Console|console]] variable [[fov]]. (This is flagged as a cheat.) | |||
*By using the [[env_zoom]] map entity. | |||
=== Optimization === | |||
* '''[http://en.wikipedia.org/wiki/Motion_sickness Motion Sickness]''' : Smaller FOVs tend to exaggerate camera movement, whilst larger FOVs tend to minimise its effect on the image. Thus setting a wider FOV can sometimes help to reduce Motion Sickness during gameplay. If you are experiencing such problems in Half-Life 2, try changing the FOV to 90 using the command "<code>sv_cheats 1;fov 90</code>" in the console. | * '''[http://en.wikipedia.org/wiki/Motion_sickness Motion Sickness]''' : Smaller FOVs tend to exaggerate camera movement, whilst larger FOVs tend to minimise its effect on the image. Thus setting a wider FOV can sometimes help to reduce Motion Sickness during gameplay. If you are experiencing such problems in Half-Life 2, try changing the FOV to 90 using the command "<code>sv_cheats 1;fov 90</code>" in the console. | ||
Line 18: | Line 26: | ||
viewer distance = (screenwidth * 0.652) | viewer distance = (screenwidth * 0.652) | ||
== FOV calculations == | === FOV calculations === | ||
* A useful rule of thumb: an object will appear twice as tall and twice as wide if the camera-to-object distance is halved. This is true for any FOV. This may be helpful when working with [[LOD]] distances such as making [[LOD Models]], [[MIP Mapping]] textures, and setting [[Fade Distance]]s. | * A useful rule of thumb: an object will appear twice as tall and twice as wide if the camera-to-object distance is halved. This is true for any FOV. This may be helpful when working with [[LOD]] distances such as making [[LOD Models]], [[MIP Mapping]] textures, and setting [[Fade Distance]]s. | ||
Revision as of 15:16, 1 February 2011
A field of view (abbreviated FOV) is the maximum angle between the peripherals of a person's or camera's vision.
There are two types of fields of view - one for players and one for NPCs:
- The player's FOV represents the Horizontal Angular Field of View, determining the angle of a geometrical viewwedge called a Frustum, whose rectangular cross-section corresponds to the player's rectangular screen.
- The NPC FOV instead represents the Angular Field of View, determining the angle of its viewcone. (You can display NPC fields of view in-game with the console command npc_viewcone.)
The player's FOV
In HL2 the player's Horizontal Field of View is set to 75 degrees. Screen settings aspect ratios are achieved by cropping the top and bottom of the image (ie reducing the vertical FOV).
You can change this value in two ways:
- By changing the console variable fov. (This is flagged as a cheat.)
- By using the env_zoom map entity.
Optimization
- Motion Sickness : Smaller FOVs tend to exaggerate camera movement, whilst larger FOVs tend to minimise its effect on the image. Thus setting a wider FOV can sometimes help to reduce Motion Sickness during gameplay. If you are experiencing such problems in Half-Life 2, try changing the FOV to 90 using the command "
sv_cheats 1;fov 90
" in the console.
- Perspective Distortion : Wider FOVs introduce more Perspective Distortion into a image, whereas small FOVs tend to flatten perspective. The distortion is caused by projecting (spherical) optical geometry onto a flat screen - that's why IMAX Dome screens are curved. Like all optical artifacts, perspective distortion is much more noticeable in still images than in the moving images of FPS gameplay. For making more cinematic screenshots, use a smaller FOV and a larger camera-object distance.
- Theoretically, an optically correct perspective can be obtained by matching the Camera's angle of view to the angle between the Player's eye and the edges of the image on his screen. Obviously this angle varies according to the actual size of the Player's screen and how far away from the screen he is actually sitting. Most players will be sitting close to a fairly small screen and unconsciously move their head position to obtain the most comfortable perspective. However, if using an unusually large screen (eg Overhead Projection) a suitable seat position can be calculated with :
viewer distance = (screenwidth)/(2*tan(FOV/2))
so where the FOV is 75 degrees:
viewer distance = (screenwidth * 0.652)
FOV calculations
- A useful rule of thumb: an object will appear twice as tall and twice as wide if the camera-to-object distance is halved. This is true for any FOV. This may be helpful when working with LOD distances such as making LOD Models, MIP Mapping textures, and setting Fade Distances.
- To calculate actual screen pixels is usually unnecessary, but quite straight forward:
- The trick is to bisect the "FOV" and use simple trigonometry to convert the Angle to a ratio of : FrameWidth / Distance = 2 (tan (FOV/2). So for the Player's 75° FOV, the FrameWidth = Distance * 1.535.
- This represents how much the Frame's dimension increases with distance - which is very useful in itself. But we want to know how an object "shrinks" (relative to the frame) over distance, so our ObjectScale is the inverse of the FrameScale, ie : 1/ (2(tan (FOV/2))). For the Player's 75° Angle of View, the ObjectScale is 1/1.535 == 0.652.
- An object which is 8 units wide and 512 units away from the Player covers ObjectScale * ObjectWidth / Distance == 0.652 * 8 / 512 = 1% of the horizontal FOV, which is 1% of the horizontal screen resolution.
- Now, if you half the distance or double the size of the object, it will cover 2% of the width of your screen.
- If your horizontal screen resolution is 1600 pixels, 1% of 1600 = 16 pixels, 2% = 32 pixels, etc.
- If the ObjectWidth is the same as the Distance, then (for Player's 75°) 0.652 * 1/1 = 65%, which is close enough to remember : 64 unit wide object viewed at 64 units distance covers 64% of the screenwidth.
- For 90° Angle of View the ObjectScale = 0.5.
- If you want it all in one formula (which is much less handy) : ObjectScreenWidth = ScreenResolution * ObjectWidth / (ObjectDistance * (2 tan (FOV/2)))

See also
- Angle of view - a Wikipedia article on view angles.
- Parallax Motion - The Wikipedia article on parallax motion.