Click or drag to resize
DigitalRuneOcclusion Buffer

DigitalRune Graphics contains the OcclusionBuffer class which implements occlusion culling.

This topic contains the following sections:

Occlusion buffer

Occlusion culling is handled by the OcclusionBuffer. The OcclusionBuffer implements occlusion culling using a hierarchical Z-buffer (HZB). (For a detailed description of the algorithm, see "Prac­ti­cal, Dynamic Vis­i­bil­ity for Games" by Stephen Hill and Daniel Collin.)

The usage is simple - occlusion culling involves only two method calls:

Occlusion Culling using the OcclusionBuffer
// Render the occluders into the occlusion buffer.
occlusionBuffer.Render(occluders, context);

// Perform occlusion culling on the list of scene nodes.
// (Scene nodes that are culled are replaced by null entries.)
occlusionBuffer.Query(sceneNodes, context);

Render takes a list of scene nodes and renders all occluders into a HZB.

Query takes a list of scene nodes (usually all objects in the scene or in the viewing frustum) and tests these nodes against the HZB. Scene nodes that are hidden by occluders are removed from the list (i.e. replaced with null entries).

Performance

Occlusion culling has a significant overhead. The process typically takes somewhere between less than a millisecond and up to several milliseconds. The overall latency depends on several factors: content, platform, timing settings, CPU/GPU load, etc.

Important note Important

Occlusion culling runs on the GPU. Accessing the results requires a readback from the GPU to the CPU, which stalls the pipeline (see Copying and Accessing Resource Data (Direct3D 10), MSDN).

Occlusion culling should only be used when there is an overall CPU/GPU saving. This needs to be determined experimentally.