The Shadow That Isn't Really There
Crouch in front of a wall in almost any modern game and look at the crease where it meets the floor. You'll see a soft, murky darkening pooled there, like the room is quietly exhaling shadow into the corner. It looks physically right. It feels grounded.
It's a lie.
No light simulation produced that shadow. No ray bounced off geometry and came back attenuated. A post-process shader ran over a two-dimensional snapshot of your screen, guessed at depth, and painted darkness where it seemed plausible. The whole trick takes a fraction of a millisecond per frame, while real ray-traced ambient occlusion can cost fifty times that. This is screen-space ambient occlusion, SSAO, and once you understand how it works you will never look at a game corner the same way again.
What the Algorithm Actually Does
Ambient occlusion, in its physically accurate form, answers one question per surface point: how much of the surrounding hemisphere is blocked by nearby geometry? A flat floor in open space scores near zero. The inside of a narrow pipe scores near one. The resulting value darkens surfaces that are hemmed in, which is why crevices, armpits, and tight corners go dim in real life.
Tracing rays to answer that question properly is expensive. For every pixel you'd need to fire dozens of rays outward into the scene, check each one for intersections with geometry, and average the results. At 1080p that's over two million pixels, each needing its own hemisphere sample. Even on modern hardware, doing this live at 60 frames per second costs more than most games can afford.
So SSAO cheats. Beautifully.
The engine already has, sitting in memory, a depth buffer: a grayscale image where each pixel's brightness encodes how far away that surface is from the camera. SSAO reconstructs approximate 3D positions from that depth data, then for each pixel it samples a small sphere of neighbouring points (typically 16 to 64 sample kernels, depending on quality settings) and checks how many of them are closer to the camera than the current pixel. The intuition: if a lot of nearby geometry is in front of you, you're probably inside a crevice. Get occluded. Go dark.
The result is blurred to hide sampling noise. The whole pass runs entirely on the 2D screen image, with no geometry traversal, no BVH trees. Just pixels talking to neighbouring pixels.
A Worked Example Worth Picturing
Imagine a character named Reza standing next to a concrete pillar pressed close to a wall behind it. The gap between pillar and wall is about thirty centimetres.
A ray tracer would fire rays from every point on that wall section, discover they hit the pillar almost immediately, and shade the wall dark accordingly. Correct, expensive.
SSAO sees the depth buffer and notices that in the screen region representing that gap, depth values jump sharply from near (the pillar's surface) to far (the wall behind it) in a tight cluster of pixels. The sample kernels around each of those wall pixels keep finding geometry that's closer to the camera. Occlusion score climbs. The gap goes dark.
Reza's friend Lena, playing the same scene on a lower preset with the SSAO radius cranked down, sees a gap that looks flat and equally lit throughout. The math still ran. It just sampled too small a neighbourhood to catch the pillar's influence. Same geometry, different lie.
Where the Trick Falls Apart
SSAO has one structural weakness that no amount of tuning fully fixes: it only knows what the camera can see.
Spin the camera so the pillar-wall gap rotates out of frame. The occlusion vanishes instantly, because the depth buffer no longer contains those depth values. Walk a character under a low overhang, then pan sideways so the overhang exits the screen, and the soft shadow under the brim disappears even though the geometry is still physically there, still blocking light. This is the screen-space problem, and it is most obvious during fast camera sweeps.
There's also the thin-geometry problem. A chain-link fence, a grate, a cluster of cables: geometry that exists in 3D but occupies very few pixels on screen. SSAO's kernels sample the depth buffer at fixed pixel offsets, so if the geometry is thinner than the sampling interval, it gets skipped entirely. The fence floats.
Engine developers have pushed hard against both of these. Horizon-Based Ambient Occlusion (HBAO), developed by Nvidia, improves quality by marching along actual screen-space horizon angles rather than sampling a random sphere. GTAO (Ground Truth Ambient Occlusion), which Ubisoft shipped in several open-world titles, adds a bent normal calculation that makes the approximation more physically coherent. None of them escape the screen-space limitation entirely. They just make the lie more convincing.
When ray-traced ambient occlusion is available and you're on hardware that handles it, it does produce meaningfully better results in exactly those failure cases. The difference is most visible in dense interior scenes with lots of overlapping geometry; in open outdoor environments with high-contrast lighting, you would struggle to spot the gap.
What People Miss When They Dismiss It
A common complaint from technically-minded players is that SSAO looks "fake" because of the halo artefacts it occasionally produces: a thin bright fringe around characters where depth discontinuity confuses the occlusion estimate. That criticism is fair. It is also missing the point by about a mile.
The technique works primarily because human vision is tuned to expect contact shadows and crevice darkening. We evolved in a world full of them, and their absence makes a scene feel weightless and artificial even when the player can't articulate why. SSAO is less a lighting algorithm and more a piece of perceptual flattery, like a set designer who knows exactly which corner of the stage the audience will actually scrutinise.
Ask yourself: when did you last notice the shadow pop on a camera sweep while you were actually playing, not while you were hunting for flaws in a YouTube comparison video? If the answer is rarely, the technique is doing its job.
Check your graphics settings. If you're running SSAO or HBAO and the occasional halo has never broken immersion, the lie is working, and that is not a small achievement.
The most interesting thing about real-time graphics isn't how accurate it is. It's how precisely the inaccuracies are calibrated to the specific limits of human perception. SSAO isn't a compromise while we wait for something better. It's a studied exploit of the fact that your visual cortex is considerably easier to fool than a physics simulator, and the engineers know it.