Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commitdf78e4f826

README.md

ssao

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

Taps are scattered over a disk around the pixel and each is weighed on its own: how far the neighbouring surface rises above this pixel's tangent plane, divided by how far away it is. A neighbour close by and high above blocks a large part of the hemisphere; the same neighbour twice as far blocks a quarter as much. Summing those contributions is the occlusion.

The taps land on a golden-angle spiral, so successive ones fall far apart in angle and a small count still covers the disk instead of clumping in one wedge; the radii are spaced by a square root so the taps are uniform over area. The spiral is offset by a per-pixel jitter, which is what turns the pattern into noise the filter can remove rather than banding.

Every tap is independent, so they carry no ordering — each one costs a texture read and a little arithmetic. hbao and gtao spend the same budget marching rays, where a tap only matters if it beats the ones nearer along the same ray.

bias is the height a neighbour must clear before it counts: without one, a flat surface reads its own depth quantisation as occlusion. The scale on the sum is the estimator's one free parameter, set so a right-angle corner reads the half-hemisphere gtao computes there in closed form.

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.