Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commitdf78e4f826

README.md

gtao

One of the three render passes behind the AmbientOcclusion component and the ao module, and the default. Selected with technique = "gtao".

For each pixel it walks a few screen-space slices; along each slice it finds the steepest horizon angle in both directions from the depth buffer, then integrates the visible arc between those horizons against the cosine lobe around the surface normal.

Integrating an arc rather than summing a per-sample occlusion term is what makes this converge to the true cosine-weighted visibility instead of a biased estimate — it is the quantity ssao and hbao are estimating. Slice rotation is jittered per pixel so the pattern lands as noise rather than banding, and the world-space radius is converted to a screen-space span from each pixel's own depth so a crease keeps its physical size as the camera moves.

bias is the elevation a sample must clear above the tangent plane before it can raise a horizon. A neighbour closer than that to the plane is the same surface read through the depth buffer's quantisation, and letting one raise a horizon is what makes a flat wall shade itself in patches. thickness rejects an occluder the ray would pass behind.

The prelude the kernel is written against, the filter that removes its sampling noise and the passes that draw it are aoShared. Settings arrive through the ao_params buffer, packed by the ao module. Sky pixels are passed through untouched.

Depth, normal and camera come from the render target being drawn, so the pass is correct in offscreen captures and RTT cameras at their own resolutions. The normal buffer is the deferred G-buffer, so this needs the deferred path.