LightsprintSDK 2021.08.08
Ambient occlusion

[Direct] ambient occlusion

Ambient occlusion on Wikipedia

[Direct] ambient occlusion is a function of a surface point and a surrounding geometry, with return value in 0..1 space, 0 for surface point fully occluded by surrounding geometry and 1 for completely unoccluded point.

[Direct] ambient occlusion is a result of direct illumination in a uniform white environment.

Global ambient occlusion

Sometimes ambient occlusion is desired to include effect of multiple light bounces and color bleeding. Let's call it global ambient occlusion.
Global ambient occlusion is a function with return value in 0..inf space, but with typical values inside 0..1 range.
Lightsprint supports global AO equally well as direct AO, so all that we say about AO matters for both direct and global AO.

Directional ambient occlusion

Information about direction of incoming light can be precomputed and used in the same way as in case of classical lightmaps. See Directional lightmaps / vertex colors for more details.

Data structures

Lightsprint can store object's ambient occlusion and global ambient occlusion in

Calculation

Calculation of ambient occlusion is non-realtime process. To calculate ambient occlusion,

  • Create RRSolver
  • Set geometry with RRSolver::setStaticObjects(). Set single object here for single object ambient occlusion. If you set scene with multiple objects here, each object will be occluded by all other objects.
  • Set uniform white environment with RRSolver::setEnvironment(RRBuffer::createSky())
  • Call RRSolver::updateLightmaps() with
    RRSolver::UpdateParameters params(quality);
    params.direct.lightMultiplier=0
    params.indirect.lightMultiplier=0
    params.direct.materialEmittanceMultiplier=0
    params.indirect.materialEmittanceMultiplier=0
    params.indirect.environmentMultiplier=0
    To calculate global ambient occlusion, skip the last line, keep environmentMultiplier=1.

See data structures (links above) for more details on calculation.

Use in renderer

See data structures (links above) for more details on use in renderer.