Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commitdf78e4f826

README.md

hbao

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

A ray is sent out along each of several screen-space directions and marched, asking one question per direction: how high above the tangent plane does the highest thing along this ray rise? That elevation is the horizon, and its sine is the fraction of the direction's half-plane that is closed off. Averaging the sines over the directions is the occlusion.

Marching a ray is what separates it from ssao: a sample only matters if it beats everything nearer along the same ray, so a wall raises the horizon once rather than once per sample taken against it. gtao marches the same way and then integrates the arc between the two horizons of a slice instead of averaging one sine per ray.

A slice is a line through the pixel, so it is two rays — each is its own direction here, which spends the quality level's taps exactly as the other two techniques spend them. Directions are rotated by a per-pixel jitter, which turns the pattern into noise the filter can remove rather than banding.

bias is the elevation a sample must clear before it can set a horizon, so a flat surface does not read its own depth quantisation as occlusion. thickness rejects an occluder the ray would pass behind. The distance fade is held off until the last part of the reach: an occluder well inside the radius is simply there, and attenuating it early is what makes a horizon-based estimate read shallower than the arc gtao integrates over the same geometry. The strength on the average is the estimator's 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.