What Is Ambient Occlusion and How Does It Work?

Ambient occlusion is a shading technique used in 3D graphics that simulates the soft shadows forming in corners, crevices, and tight spaces where light has a harder time reaching. If you’ve ever toggled a graphics setting in a game and noticed that objects suddenly look more grounded and realistic, with subtle darkening where a wall meets the floor or where folds overlap in clothing, that’s ambient occlusion at work.

How Ambient Occlusion Works

In the real world, light bounces around a scene and reaches most surfaces eventually. But some spots receive less indirect light than others: the crease of a folded curtain, the gap between two stacked crates, or the underside of a shelf. These areas appear slightly darker, not because they’re in a direct shadow, but because surrounding geometry blocks some of the ambient light from arriving.

Ambient occlusion approximates this effect by calculating, at every point on a surface, how much of the surrounding hemisphere is blocked by nearby geometry. Imagine standing at a single point on a wall and looking outward in every direction across a dome above that point. If most of those directions are open sky, the point gets full light. If half those directions are blocked by a nearby object, the point gets darkened by roughly half. The technique casts virtual rays outward from each surface point, checks whether they hit another object, and averages the results. Rays closer to the surface normal (pointing straight out from the surface) are weighted more heavily than rays at steep angles, which mirrors how real light interacts with surfaces.

The result is a single brightness value per point, essentially a grayscale map of the entire scene showing where light penetrates freely and where it’s partially blocked. This map is then layered over the scene’s lighting to add depth and contact shadows that make objects feel physically present in their environment.

Why It Makes Such a Big Visual Difference

Without ambient occlusion, objects in a 3D scene can look like they’re floating or pasted on top of their surroundings. A box sitting on a floor, for example, has no visible transition between its base and the surface beneath it. Everything receives the same flat ambient light, which looks unnatural because our eyes are trained to expect subtle darkening in enclosed areas.

Adding ambient occlusion provides those contact cues. The box now has a gentle shadow pooling at its base. The seams between bricks on a wall gain depth. A character’s nostrils, the folds in their jacket, and the space between their fingers all darken slightly. None of these require a direct light source casting a shadow. They’re purely the result of geometry blocking ambient illumination, and the effect is surprisingly powerful for how subtle it appears.

Screen-Space Ambient Occlusion (SSAO)

The most common version you’ll encounter in game settings is screen-space ambient occlusion, or SSAO. Instead of calculating occlusion across the entire 3D scene (which would be extremely expensive), SSAO works only with what’s currently visible on your screen. It samples the depth buffer, a behind-the-scenes map of how far each pixel is from the camera, and uses that information to estimate which areas are recessed or enclosed.

SSAO is fast and runs on virtually any modern hardware, which is why it became the default option in most games. Its weakness is that it can only “see” what’s on screen. If an object just outside the camera’s view should be casting an ambient shadow into the visible scene, SSAO misses it entirely. This can cause shadows to pop in and out as you move the camera, and areas like the underside of parked cars often appear unrealistically bright because the ground plane extends beyond the screen edges.

Early SSAO implementations also tended to produce soft, muddy darkening that lacked sharp definition. Shadows would sometimes appear as vague halos around objects rather than precise contact darkening.

HBAO and HBAO+

Horizon-Based Ambient Occlusion (HBAO) improved on basic SSAO by using a more physically grounded algorithm. Rather than simple depth comparisons, HBAO approximates the actual light-blocking integral by sampling the depth buffer more carefully and using more samples per pixel. The result is noticeably sharper and more defined ambient shadows, particularly in detailed environments where basic SSAO would produce only a faint, blurry effect.

HBAO+ is NVIDIA’s optimized library version of this technique, designed for easier integration into games. It retains the quality improvements of HBAO while being tuned for better performance. If you see HBAO+ as an option in your graphics settings, it’s generally a meaningful step up from basic SSAO with a moderate performance cost.

VXAO: Voxel-Based Ambient Occlusion

Voxel Ambient Occlusion takes a fundamentally different approach. Instead of relying on what’s visible on screen, VXAO builds a simplified 3D representation of the entire scene using voxels (tiny cubes, like 3D pixels). This voxelized version of the world includes objects behind the camera and things currently hidden from view.

Because VXAO works in “world space” rather than screen space, it can cast ambient shadows from objects just outside the player’s field of view, and from large occluded structures in the distance that realistically affect the scene’s lighting. The accuracy is significantly higher than any screen-space method. Shadows remain stable as the camera moves and appear in places where SSAO would show nothing. The tradeoff is a heavier performance cost, and VXAO has seen limited adoption in commercial games.

Ray Traced Ambient Occlusion (RTAO)

With modern GPUs supporting hardware-accelerated ray tracing, ray traced ambient occlusion has become the gold standard. RTAO fires actual rays into the 3D scene from each surface point, just like the theoretical model described earlier, and checks for intersections with real geometry. It isn’t limited to what’s on screen, and it doesn’t rely on a simplified voxel approximation.

The difference is most visible in scenes with complex geometry. In Unreal Engine’s comparisons, areas under vehicles appear noticeably brighter with SSAO because the screen-space method can’t account for the ground extending beneath the car. RTAO correctly darkens those areas because its rays interact with the full scene geometry. Halos and other artifacts common in screen-space techniques largely disappear.

RTAO requires a GPU with dedicated ray tracing hardware (like NVIDIA’s RTX series or AMD’s RDNA 2 and newer cards). The performance impact varies by game, but it’s typically one of the lighter ray tracing effects, making it a good first option to enable if you’re experimenting with ray tracing settings.

Tuning AO in Game Settings

Most games and engines expose two main controls for ambient occlusion. Intensity determines how dark the occlusion shadows become. Higher values create more dramatic darkening in crevices, while lower values keep the effect subtle. Radius controls how far from each pixel the algorithm searches for nearby geometry. A small radius produces tight contact shadows right where surfaces meet. A larger radius creates broader, softer darkening that can simulate light being blocked by bigger structures, but can also look muddy if pushed too far.

Some games offer a simple quality dropdown (low, medium, high) that adjusts the number of depth samples taken per pixel. More samples produce cleaner results with less noise, but cost more performance. If you’re seeing grainy or noisy shadows around objects, increasing the sample count or quality level usually solves it.

For most players, the practical choice comes down to the options available in a given game. If you see SSAO, HBAO+, and RTAO as separate options, they’re listed roughly in order of both quality and performance cost. SSAO is the lightest and least accurate, HBAO+ offers a solid middle ground, and RTAO delivers the most realistic results if your hardware can handle it.