Screen space ambient occlusion


I recently wrote an SSAO shader to further enhance my renderer quality. This effect approximates global illumination by computing an ambient occlusion map in a post-processing pass.

The cost of this shader is relatively low for its benefits, and is independent of the scene complexity.

The image to the right shows:

  • Blurred SSAO output
  • Directional Lighting
  • Lighting and SSAO


  • C#
  • HLSL
  • XNA


  • Up to 32 samples per pixel
  • Use normal information
  • Smart blur to smooth out noise while preserving edges

Code samples:


Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License