Screen space ambient occlusion
This article may be too technical for most readers to understand.(July 2020)
Screen space ambient occlusion (SSAO) is a computer graphics technique for efficiently approximating the ambient occlusion effect in real time. It was developed by Vladimir Kajalin while working at Crytek and was used for the first time in 2007 by the video game Crysis, also developed by Crytek.
The algorithm is implemented as a pixel shader, analyzing the scene depth buffer which is stored in a texture. For every pixel on the screen, the pixel shader samples the depth values around the current pixel and tries to compute the amount of occlusion from each of the sampled points. In its simplest implementation, the occlusion factor depends only on the depth difference between sampled point and current point.
Without additional smart solutions, such a brute force method would require about 200 texture reads per pixel for good visual quality. This is not acceptable for real-time rendering on current graphics hardware. In order to get high quality results with far fewer reads, sampling is performed using a randomly rotated kernel. The kernel orientation is repeated every N screen pixels in order to have only high-frequency noise in the final picture. In the end this high frequency noise is greatly removed by a NxN post-process blurring step taking into account depth discontinuities (using methods such as comparing adjacent normals and depths). Such a solution allows a reduction in the number of depth samples per pixel to about 16 or fewer while maintaining a high quality result, and allows the use of SSAO in soft real-time applications like computer games.
Compared to other ambient occlusion solutions, SSAO has the following advantages:
- Independent from scene complexity.
- No data pre-processing needed, no loading time and no memory allocations in system memory.
- Works with dynamic scenes.
- Works in the same consistent way for every pixel on the screen.
- No CPU usage – it can be executed completely on the GPU.
- May be easily integrated into any modern graphics pipeline.
SSAO also has the following disadvantages:
- Rather local and in many cases view-dependent, as it is dependent on adjacent texel depths which may be generated by any geometry whatsoever.
- Hard to correctly smooth/blur out the noise without interfering with depth discontinuities, such as object edges (the occlusion should not "bleed" onto objects).
- "What is Ambient Occlusion? Does it Matter in Games?".
- Tobias Ritschel; Thorsten Grosch; Hans-Peter Seidel (2009). "Approximating Dynamic Global Illumination in Image Space". Proceedings ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games. Retrieved 25 November 2015.
- Finding Next Gen – CryEngine 2
- Video showing SSAO in action
- Image Enhancement by Unsharp Masking the Depth Buffer
- Hardware Accelerated Ambient Occlusion Techniques on GPUs
- Overview on Screen Space Ambient Occlusion Techniques
- Real-Time Depth Buffer Based Ambient Occlusion
- Source code of SSAO shader used in Crysis
- Approximating Dynamic Global Illumination in Image Space
- Accumulative Screen Space Ambient Occlusion
- NVIDIA has integrated SSAO into drivers
- Several methods of SSAO are described in ShaderX7 book
- SSAO Shader ( Russian )
- SSAO Tutorial, extension of the technique used in Crysis