Voxel Ray Traversal Research
Rendering 1 trillion voxels at 120fps through pseudo-octree optimization
The Challenge
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 breakthrough
Traditional octrees barely helped. After a lot of profiling the bottleneck was clear: GPUs handle recursion and stack operations poorly. Each ray walked millions of voxels at O(n), and the recursion overhead ate any benefit the octree was supposed to give.
The fix was to drop recursion entirely and use a flattened, hard-coded layer hierarchy. This "pseudo-octree" keeps the spatial subdivision but removes the stack:
- Layer 1: Voxel (1 bit of storage)
- Layer 2: Brick (8³ = 512 voxels)
- Layer 3: Coarse grid (16³ = 4,096 bricks)
- Layer 4: Chunk (16³ = 4,096 coarse grids)
That took traversal from O(n) to O(log n) and cleared the bottleneck. Each extra layer scales exponentially, which is what makes trillion-voxel scenes tractable.
What it led to
This is part 01 of my voxel line. The 8³ brick and the idea of skipping empty space in big steps carried straight into part 02, where the GPU's RT cores took over the hierarchy, and from there into the per-face irradiance cache, where the brick became the unit lighting is stored in.
Notes
This builds directly on the original implementation. Like the rest of the voxel line, it was a learning case study: I used Claude Code to write much of the Rust and Vulkan so I could spend my time on the architecture and the algorithm itself.
Worth a look: the original repo and the DDA paper that started it.
Try it: hierarchical DDA
Move the pointer to aim the ray, click to reposition the ray's origin. Toggle the coarse level to see empty space get skipped 4x4 at a time.
All captures (25)
Most of the month was debugging. These artifacts showed up along the way, each one pointing at a ray traversal edge case or a spatial indexing mistake.