Ambient occlusion is a shading and rendering technique used to calculate how exposed each point in a scene is to ambient lighting. It is used to create soft shadows and add realism to 3D scenes by approximating the way light radiates in real life.
The Basic Concept
The basic idea behind ambient occlusion is that surfaces facing each other tend to block out or occlude ambient light sources. Areas like corners and crevices receive less ambient light, and therefore appear darker. Meanwhile, protruding and exposed areas receive more ambient light and appear brighter. This creates instant depth and contrast.
Ambient occlusion works by checking the occlusion between points in a scene, and using that information to determine local visibility and thus how much ambient lighting reaches each point. The more a point is occluded, the darker it will appear. The algorithm casts rays in a hemisphere surrounding each point on the surface, checking for intersections with other geometry. The more intersections there are, the more occluded and darker that point will become.
Unlike shadows created by direct light sources, ambient occlusion simulates how ambient light is blocked by the physical proximity of other objects. While shadows have hard edges, ambient occlusion creates soft, subtle shading in corners, creases, holes, and intersections. This replicates real-world lighting where ambient light still reaches indirectly illuminated areas, just at a lesser intensity. When done well, ambient occlusion adds a life-like sense of depth, surface detail, and darkness to scenes.
Applications and Uses
Ambient occlusion is extremely useful for replicating complex real-world lighting and materials. It is heavily used in cinematic rendering and visual effects to create photorealistic results. When paired with techniques like global illumination, it greatly enhances the perception of depth and detail.
It is also invaluable for video games, allowing real-time ambient occlusion effects to be calculated efficiently on graphics hardware. This brings vastly improved lighting quality to real-time rendered scenes. Effects like Screen Space Ambient Occlusion (SSAO) approximate ambient occlusion based on screen-space data as opposed to a full preprocessing step. This allows believable ambient occlusion to be used extensively in games, adding depth and atmosphere with minimal performance impact.
Ambient occlusion is equally useful for non-photoreal rendering. It can be used in stylised or comic book style games and animations to add mood, atmosphere and accentuate forms. So while originally developed for simulating realistic lighting, ambient occlusion offers aesthetic possibilities for many styles of rendering.
Different Ambient Occlusion Techniques
There are various techniques and algorithms for calculating ambient occlusion, each with their own advantages and use cases.
Some of the most common and significant include:
- Ray Traced Ambient Occlusion – Traces rays for each sample point and calculates occlusion based on intersections. Very accurate but expensive to compute. Well suited for offline rendering.
- Screen Space Ambient Occlusion (SSAO) – Estimates occlusion based on depth buffer information. Efficient for real-time use but lower accuracy.
- Voxel Cone Tracing – Uses a voxel representation of the scene to accelerate occlusion calculations. Balances quality and performance.
- Horizon-Based Ambient Occlusion (HBAO) – Approximates occlusion based on the horizon angle for each point. Optimized for GPU efficiency.
- Vertex Ambient Occlusion – Calculates ambient occlusion at each vertex, then interpolates vertex AO across polygons. Faster than per-pixel/sample AO.
- Geometric Ambient Occlusion – Precomputes AO for static geometry using actual scene complexity rather than sample points. Bakes lighting into texture maps.
There are constant innovations in ambient occlusion technology tailored to the needs of different industries and usage scenarios. From offline rendering to real-time applications, ambient occlusion continues to be an indispensable tool for creating realistic and atmospheric lighting in CG environments. When used creatively, it brings mood, contrast and ambience to computer generated imagery across all visual styles.