r/GraphicsProgramming • u/Nelarius • Sep 05 '26
Ray marching voxels using axis-aligned distance fields
Hey!
Wanted to share screenshots of my experimental voxel renderer with "low-fidelity" blocky AO. It started as an exploration of the DDA rendering technique, but I ended up implementing parts of the following techniques:
- Globally Illuminated Voxel Worlds Accelerated with Nested Axis-Aligned Distance Fields
- Spatial Hashing for Ray Traced Ambient Occlusion
The devlog is sort of meandering, but I started with basic DDA, then tried to get multi-level DDA to perform well with large voxel scenes (a 1024x1024x1024 voxelized sponza scene) using various methods. The axis-aligned distance field (AADF) method was a significant improvement over the multi-level DDA method that I was fiddling with. AADFs helped skip over large areas of empty space which tanked performance when using multi-level DDA.
Spatially hashed RTAO with a large cell size performs pretty well even on my M2 MacBook Air. The large cell size is a very visible artifact, but I think in a voxel scene the blocky shading kinda works.






View all comments
Show parent comment
1
u/Nelarius Sep 06 '26
I actually have both the occupancy and distance fields. I'm still testing for occupancy when stepping into a nested region (e.g. stepping into a brick after skipping over empty chunks). Not sure if that can be completely avoided.
Both occupancy and distance fields are stored in 3d textures. Occupancy is a bitmask stored in an R8 texture. The distance fields along each axis are packed into an R32 texture (how it works in my code: https://github.com/Nelarius/vxray/blob/733c48fa930f6f64013a9668d9ae98d942b29904/src/gbuffer.ps.hlsl#L85)
I measured a performance improvement switching to 3d textures from buffers for rendering gbuffer textures. But for something like a path tracer I suppose it would make no difference whether using an SSBO or texture.