Chunk Occlusion Culling
intermediate featureChunk Occlusion Culling skips rendering the chunks the camera cannot actually see because solid geometry (walls, terrain, floors) stands between them and the viewer. It targets enclosed and underground environments - caves, tunnels, dungeons, buildings, pyramids - where large parts of the world are sealed away from view.
Enabling it
Enable the Occlusion Culling option in the Voxel Play Environment inspector (enableChunkOcclusionCulling from script). It is off by default. In wide open terrain it has little to no effect, so turn it on when your scene contains substantial enclosed or subterranean areas.
How it works
This is not a depth-buffer technique. It does not read back the GPU depth buffer, it does not issue per-object visibility queries, and it does not rely on draw order or on a depth pre-pass the way a GPU occlusion system such as URP's built-in occlusion culling does. Instead it works directly on the voxel data, on the CPU, before any chunk is submitted for rendering.
The rule it applies is simple: a chunk can only be seen if open space connects it to the chunk the camera is in. Starting from the camera's own chunk, Voxel Play lets the empty (air) space flow outward - from that chunk into its open neighbours, and from those into theirs - passing through every opening it finds. Any chunk this open space reaches is treated as potentially visible and is drawn. Any chunk it never reaches, because solid blocks seal it off on all sides, is fully enclosed, cannot be seen, and is skipped.
A useful way to picture it: imagine light spreading out from where you stand inside a cave. It pours through doorways, corridors and gaps, but stops dead at solid walls. Rooms behind a wall, or terrain buried under the surface, never receive that light - and those are exactly the chunks that get culled.
Getting the best results
Because the visibility test is based on open-space connectivity, the culling pays off in proportion to how much your world is genuinely broken up by solid geometry. The more your chunks are separated from one another by walls, packed earth or other obstacles, the more of them can be proven hidden and skipped:
- Enclosed layouts win the most. Dungeons, tunnels, sealed rooms, thick terrain and multi-level interiors give the largest savings, because sight is blocked in most directions.
- Solid separators are what enable culling. A wall, a floor or a mass of earth between two areas lets the far area be hidden. Leave open windows, doorways or gaps and the space beyond them stays connected, so it keeps drawing.
- Open terrain gains little. On a flat or lightly built surface almost everything is connected through the open sky, so few chunks can ever be hidden. That is expected - leave the option off for those scenes.
The test is evaluated as chunks are built and refreshes as the world changes around the camera, so opening a new passage or breaking through a wall immediately reveals whatever is now reachable, and sealing an area off hides it again.
Suggest an improvement
Help us improve this documentation page.