← All work

RT-Core Voxel Ray Tracing

Hardware BVH traversal to the brick, DDA inside it, path-traced lighting on top.

When
Jun – Jul 2026
Stack
Rust · Vulkan · Ray Query
Captures
20

The second project along my voxel line. I started rebuilding the software hierarchy from part 01 by updating it to branch by a factor of 4 - mathematically more efficient. But after testing performance, I realized I was just trying to replace hardware's job with my own software implementation, so I replaced the whole hierarchy with the GPU's ray tracing cores. They Ray-Query walk a BVH down to the brick, and only then does the software DDA finish the job inside it. Hardware handles the sparse empty space, while DDA handles the dense part.

What changed from part 01

  • The world becomes a flat list of boxes: one 8³ box per detailed brick, and one big solid box per uniform region. The RT cores build and walk the BVH over them.
  • Every ray (primary, shadow, bounce) is a ray query from a compute shader. The hardware hands back candidate boxes, and the shader confirms each one with an exact slab test, since the RT cores only test a slightly enlarged box.
  • Inside a detailed brick, an Amanatides-Woo DDA over its 8³ voxels finds the exact voxel and face.
  • With traversal this cheap, there was budget for real lighting: a path tracer with sun shadows (soft, via next-event estimation), diffuse bounces, emissive blocks, and accumulation while the camera holds still.
  • A Steps heatmap counts the work the shader does per pixel, which is how I tuned the optimization passes.

What it led to

Path tracing every pixel every frame is still noisy and expensive. Staring at that noise is what pushed me to the irradiance cache: keep the rays, but store what they learn on the voxel faces so nothing gets thrown away. The 8³ brick from this project became the cache's addressing unit.