Screen Space Ambient Occlusion (Tech Demo)

I have had an interest in this technique since the release of Crysis, and after gaining some knowledge and experience with shaders through my shadow mapping demo and (Untitled) game demo I looked into producing an implementation of the technique. The SSAO is calculated using a full screen quad, and takes samples starting from the centre outwards in a spiral, allowing the samples to be subject to jitter in order to reduce the appearance of banding due to the nature of the sampling.

Features and Techniques

  • Choose to output diffuse lighting only, SSAO output only, or the diffuse lighting and SSAO combined
  • User controlled tweakable: Alter size of sampling area
  • User controlled tweakable: Alter number of samples per pixel
  • User controlled tweakable: Alter the intensity of occlusion
  • User controlled tweakable: Alter amount of jitter present when calculating the SSAO
  • Toggle surface format precision (if supported)

Screenshots

Click an image to enlarge (opens a new window).

image image image image
image image image image

Download

Please download the demo here. Controls are included in a text file within the download. Source code available upon request.

Requirements

  • Shader Model 3.0 or greater capable graphics card.
  • March 2008 or later version of DirectX 9.0 re-distributable. Download the latest version here.
  • Built using Microsoft Visual C++ 2008 SP1 and requires the latest Microsoft Visual C++ Library Runtimes. The latest runtimes for the x86 platform can be downloaded here.