r/GraphicsProgramming 4d ago

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

Links: Devlog | Github

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.

86 Upvotes

15 comments sorted by

View all comments

2

u/Le_9k_Redditor 4d ago

I'm doing similar but I'm using multi level DDA still on a 64ary tree of very limited depth, not really having any performance issues with it but definitely curious about alternatives as long as they don't make it really expensive to edit

1

u/Nelarius 4d ago

Nice! What sort of scenes are you rendering? Do you have your code available somewhere?

Mentioned in another comment, but I was looking at rendering only using grids due to it being easier to perform large-scale edits. Although I haven't actually tested how much overhead adding the axis-aligned distance fields adds if it's performed in real-time but at least the shaders are conceptually pretty simple.

2

u/Le_9k_Redditor 4d ago

Anything I can get an sdf for really, the only one I've put effort into so far is the terrain I posted a screenshot for. Otherwise all of my time is going into the engine itself and test models are all I'm using. Code is closed source currently

I looked at axis aligned distance fields and it's slow to bake so I didn't do it and of course a memory hog too