Computes
the accessibility factor in real-time, which must be done efficiently.
This
was first used in the game Crysis,
using multi-pass rendering.
Rather
than evaluate the integral directly, a random (Monte-Carlo) sampling technique
is used.
Approach:
- Pass 1:
Render the scene to texture.
- Pass 2:
Randomly sample the depth buffer around the current point p
(this can based on the normal if available).
Count the points that are closer; these block the light coming to p. Encode occlusion as a value [0, 1].
- Pass 3:
Blur the output from Pass 2, and darken fragments based on the AO term.
Tutorial: j
ohn-chapman-graphics
Video:
SSAOThere
are also details in the SuperBible,
including shader code.