ambientOcclusion

A post-process stage that applies Horizon-based Ambient Occlusion (HBAO) to the input texture.

Ambient occlusion simulates shadows from ambient light. These shadows would always be present when the surface receives light and regardless of the light's position.

The uniforms have the following properties:

  • intensity is a scalar value used to lighten or darken the shadows exponentially. Higher values make the shadows darker. The default value is 3.0.

  • bias is a scalar value representing an angle in radians. If the dot product between the normal of the sample and the vector to the camera is less than this value, sampling stops in the current direction. This is used to remove shadows from near planar edges. The default value is 0.1.

  • lengthCap is a scalar value representing a length in meters. If the distance from the current sample to first sample is greater than this value, sampling stops in the current direction. The default value is 0.26.

  • directionCount is the number of directions along which the ray marching will search for occluders. The default value is 8.

  • stepCount is the number of steps the ray marching will take along each direction. The default value is 32.

  • randomTexture is a texture where the red channel is a random value in 0.0, 1.0. The default value is undefined. This texture needs to be set.

  • ambientOcclusionOnly is a boolean value. When true, only the shadows generated are written to the output. When false, the input texture is modulated with the ambient occlusion. This is a useful debug option for seeing the effects of changing the uniform values. The default value is false. When enabled, this stage will execute before all others.

See also