Horizon-Based Ambient Occlusion

Ambient occlusion is a shading and rendering technique used to calculate how exposed each point in a scene is to ambient lighting. For example, the interior of a tube is typically more occluded (and hence darker) than the exposed outer surfaces, and the deeper you go inside the tube, the more occluded (and darker) the lighting becomes. At the 2008 SIGGRAPH tech conference NVIDIA introduced an upgraded SSAO variant called Horizon Based Ambient Occlusion (HBAO).

Unlike previous SSAO variants, HBAO uses a physically-based algorithm that approximates an integral with depth buffer sampling. In other words, the upgrade enables HBAO to generate higher-quality SSAO whilst increasing the definition, quality, and visibility of the AO shadowing.

Unfortunately, rendering HBAO at reduced resolutions inevitably causes flickering that is challenging to hide in all situations. And, reconstructed normal from depth causes the discontinuous normal on edge.

<Discontinuous normal on edge>

The solution is  taking 5 depth samples for normal reconstruction. They are positioned like a cross. The center sample is the pixel you’re currently rendering and you sample the pixel above, left, right and below that center sample. Then for normal reconstruction you simply take the closest Y sample (either the one above or below the center sample) and the closest X sample (either the one left or right of the center sample) relative to the center sample.


<HBAO + Scene>