Software occlusion culling in Block Game
A game developer built a CPU-based software occlusion culling system for a voxel game, using a 256x128 depth buffer and hierarchical subchunk mipmaps to accelerate rendering on weak integrated graphics.
read it A detailed postmortem with algorithm designs and concrete optimizations that rewards technical readers interested in low-level graphics and game engine performance.
summary
The developer of a custom voxel game needed an occlusion culling solution that runs efficiently on weak integrated GPUs without complex GPU readbacks. By rendering low-resolution depth buffers on the CPU using custom coordinate transforms and a multi-level subchunk mipmap, they reduced culling time from 200ms to 4ms per frame. The approach efficiently skips hidden underground geometry, achieving massive framerate boosts in caves while avoiding complex GPU-driven pipelines. Limitations include reduced effectiveness when flying high above any local occluders.
key points
- Rendering a tiny 256x128 depth buffer on the CPU using 3x3 rotation matrices avoids costly 4x4 matrix projections and GPU stalls.
- A hierarchical subchunk structure categorizes occluders from single blocks up to full chunks, drastically reducing vertex transformation overhead.
- The sequence of five specific optimizations reduced overall culling processing time from 150-200ms down to just 4ms at a 12-chunk render distance.
who should read it
Game developers, engine programmers, and engineers interested in software rendering and low-level performance optimization.
discussion positive
consensus
Commenters debate the CPU versus GPU culling trade-off, agreeing that while GPU-driven hierarchical Z-buffer techniques dominate modern hardware, CPU software culling remains practical for low-end or integrated graphics.
pushback
Some point out that GPU-driven techniques using previous-frame depth buffers can introduce visual artifacts when objects suddenly become visible.
If you can turn the problem into a small kernel operating on a heap of data (or a hierarchy), the GPU almost always wins for culling, especially if you pipe the cull into the draw with GPU-driven rendering.
If the author used GPU culling it would likely be faster on modern hardware, they just said they can't because of platform restrictions. But that's what AAA games do.
The modern non-nanite techniques here are basically to regularize to grids, cull the grids on the GPU, and then cull more with a HZB. That's your "mipped occlusion boxes", except it's actually very cheap to do this because …
Explains modern GPU-driven rendering techniques like HZB and grid regularisation used in AAA titles, providing architectural context on how this CPU approach contrasts.
Generated by an LLM from the article and thread. Check the sources before relying on it.