Viewing Frustum and Frustum Culling


What is the viewing frustum?

The viewing frustum is the field of view of the camera that the player is currently viewing the world through. Any part of the game world within the viewing frustum may appear on screen. Any part of the game world outside of the viewing frustum will not appear on screen.

The shape of the viewing frustum is depends on the type of camera being simulated, but is typically a rectangular pyramid. A “near plane” and “far plane” also cut the frustum and prevent objects that are too close or too far away from the player from being shown.

An example of a viewing frustum.
An example of a viewing frustum. (Source)
In brief:
The viewing frustum defines the part of the game world that the player can currently see.

What is frustum culling?

When the game world is being drawn for a given frame a lot of the objects within the game will not be visible, due to being to the side of or behind the player for example. Preparing an object to be drawn to the screen (rendering the object) can be relatively expensive in processing terms, which is then wasted if it ends up actually being off screen.

Frustum culling is the term for preventing these objects from being rendered by determining early in the process that they are outside of the frustum. As objects can have quite complex shapes, the decision is usually made based on a bounding volume (a simpler approximation of the shape of the object) so that one expensive operation isn’t simply replaced with another.

For a nice animation demonstrating frustum culling, see the top of this Kotaku article. (The article drew some mockery due to presenting old techniques as revolutionary, but the techniques themselves are valid.)

In brief:
Frustum culling prevents rendering of out-of-sight objects, resulting in less processing per frame and thus higher framerates.

What can go wrong?

A poor implementation may cause objects near the edge of the field of view to disappear when they should still be visible. This is down to the individual implementation and is not a problem with the technique itself.

Very large objects can negate the advantages of frustum culling. If the player can see some part of the object then the remainder of it, which is likely off screen, will still be rendered. For large objects this can be very expensive. This is typically resolved by forming a large object out of multiple smaller objects that can then be culled as needed.

  • Backface culling
  • Occlusion culling