Rendering 1 trillion voxels at 120fps through pseudo-octree optimization
After discovering a video about the DDA ray traversal technique for rendering voxels at high framerates, I learned the creator was planning a follow-up on implementing octrees to render trillions of voxels at 100+ fps. This became the foundation for my research into optimizing voxel rendering performance.
Building on the original implementation, I explored various optimization strategies over the course of a month, iterating through different spatial data structures and GPU compute approaches in Vulkan.
The optimization process involved extensive debugging and iteration. The following visual artifacts emerged during development, each revealing insights into ray traversal edge cases and spatial indexing issues:
Traditional octree implementations yielded minimal performance gains. After extensive profiling and optimization attempts, the bottleneck became clear: GPUs handle recursion and stack operations poorly. Each ray required traversing millions of voxels with O(n) complexity, while the overhead of traditional octree recursion negated potential benefits.
The solution involved replacing recursive octrees with a flattened, hard-coded layer hierarchy. This "pseudo-octree" structure eliminates recursion overhead while maintaining spatial subdivision benefits:
This flattened structure reduced ray traversal complexity from O(n) to O(log n), resolving the primary performance bottleneck. Each additional layer provides exponential performance scaling, enabling efficient traversal of trillion-voxel scenes.
This research project builds upon the foundation provided by the original implementation. The work involved extensive learning in graphics programming, GPU optimization, and spatial data structures. Development utilized AI-assisted coding tools (Claude Code) to accelerate implementation and testing of various design approaches, particularly for Rust and Vulkan components. The month-long development cycle required iterative refinement of high-level architectural decisions and algorithmic strategies.
Check out the original repo and the DDA paper that started it all.