Enabling Ambient Occlusion in Games

Enabling Ambient Occlusion in Games

Note that this is an archived copy of the original article. Please see here for a more detailed explanation.

Ambient Occlusion is a visual effect that was originally developed by Industrial Light and Magic (ILM) and used in the 2001 film Pearl Harbor. Hardware support has been available since 2003 with NVIDIA’s GeForce FX. One of the first games to use ambient occlusion was Crysis, which was developed by Crytek and released in late 2007. In 2009, NVIDIA added Ambient Occlusion as a Control Panel feature in its v185 drivers. An up-to-date list of games that support ambient occlusion through the Control Panel is given at the end of this article.

What It Is and How It Works:

One of the most difficult challenges in 3D game design is realistically modeling the behavior of light and its effects on various textures and surfaces without compromising frame rate. On a movie set, animators can leverage huge amounts of computational power and have the luxury of spending hours on a single frame. 3D game engines have no such luxury. Ambient occlusion is a technique to produce film-like lighting quality with real-time performance.

Ambient occlusion is a lighting model that calculates the brightness of a pixel in relation to nearby objects in the scene. More specifically, it determines when certain pixels are blocked from the environmental light by nearby geometry, in which case, its brightness value is reduced. It accounts for the general dimming effect when two evenly lit objects are brought close to each other.

Below are some examples of how ambient occlusion works, beginning with a simple model.

Dragon statue with no AO

The Stanford dragon above is rendered in an evenly lit environment. There are a few darker and lighter areas on the model, but the lighting is mostly uniform. Despite having fairly intricate geometry, the dragon appears flat and without clear depth perception.

Below is the same model, with ambient occlusion enabled.

Dragon statue with AO

The most distinct change with AO is that smooth shadows have been added to the image. Unlike standard shadows which appear as solid regions enclosed by blurred edges, AO based shadows have wide and smooth gradations.

Ambient occlusion can be thought of as an approximate form of global illumination (GI). GI calculates the color of each pixel based on the light contributed from the surrounding hemisphere. Areas that are fully exposed to the surrounding environment (such as the dragon’s fins) appear brighter, whereas areas that are blocked (such as the dragon’s inner belly) appear darker. To calculate these characteristics using GI typically requires a large number of raytracing operations which is not feasible in a realtime environment. AO achieves a similar effect by comparing the relative depth of neighboring pixels. The end result is that AO is able to render softly lit and shadowed images with a global illumination look and feel in real-time.

In modern games, ambient occlusion may be listed in the graphics options menu as HBAO or SSAO. Both refer to ambient occlusion; HBAO (Horizon Based Ambient Occlusion) is an optimized type of SSAO (Screen Space Ambient Occlusion). If a game supports AO via a menu option set it there. Otherwise, set it in the NVIDIA Control Panel (see the appendix of this article for a full list of supported games). There is no need to set it in both locations and no benefit to doing so.

To activate AO in a game that doesn’t natively support it, do the following:

  • Right-click on the desktop, then select the NVIDIA Control Panel.
  • Click on “Manage 3D Settings”
  • Highlight “Ambient Occlusion.”
  • Select either Performance or Quality. Performance is faster, Quality produces finer images. Prior to the release of the 256 driver series, Ambient Occlusion could only be set to “On” or “Off” in the NVIDIA Control Panel. Release 256 allows users to switch between two different quality levels, as shown below .

NVIDIA Control Panel AO setting

Comments

This comment section is currently disabled. Click here to enable comments and load all Disqus related resources

Please note that by enabling and loading these Disqus resources, you are agreeing to allow everything that comes with a Disqus comment section, including their cookies and all scripting.