Field of View

From Valve Developer Community
Jump to: navigation, search
English (en)Español (es)Translate (Translate)

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 (in all games since Source), (also in Sven Co-op version 5.04+ and Half-Life post-25th anniversary update), determining the angle of a geometrical viewwedge called a Frustum, whose rectangular cross-section corresponds to the player's rectangular screen.
    In GoldSrc and earlier titles (and older versions of Half-Life), it is Vertical- Angular Field of View instead.
  • 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 Half-Life 2 Half-Life 2, the player's vertical Field of View is set to 75 degrees by default. Screen settings aspect ratios are achieved by expanding the horizontal field of vision, not by cropping top and bottom portions of the image. Thus, the player will see more of the picture when using a widescreen aspect ratio than when using standard 4:3.

You can change this value in three ways:

  • By changing the console variable fov. (This is flagged as a cheat.)
  • By changing the console variable fov_desired. (Some games may not have this variable, especially with older games and/or engine branch.)
  • By using the env_zoom map entity.

Optimization

  • Motion sickness : Smaller FOVs tend to exaggerate camera movement, whilst larger FOVs tend to minimize 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 "fov_desired 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 (e.g., overhead projection), a suitable seat position can be calculated with :
viewer distance = (screenwidth)/(2*tan(FOV/2))

so where the horizontal 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:
    1. 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.
    2. 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.
    3. 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.
    4. Now, if you half the distance or double the size of the object, it will cover 2% of the width of your screen.
    5. 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


Stub

This article or section is a stub. You can help by adding to it.