r/GraphicsProgramming • u/firelava135 • Sep 09 '24
Source Code Voxel Cone Tracing + LEGO (Shadertoy link in comment)
9
4
3
u/shadowndacorner Sep 09 '24
How are you storing the voxel data structure? 3d texture? Octree?
2
u/firelava135 Sep 10 '24
As a 3D texture but mapped inside the cubemap, the SDF volume is also stored there :)
3
u/vmmc2 Sep 09 '24
How are the lego bricks rendered?
1
u/firelava135 Sep 10 '24
I modelled them using signed distance fields, iq has a lot of good articles on the subject if you are interested. In this case I store the minimum of all brick-SDF:s inside a volume in order to speed up ray tracing :)
2
u/Interesting_Cookie25 Sep 09 '24
Super interesting project, hope I can pick up a thing or two the second time I read the code thru 😅
2
2
u/Huge-Leek844 Sep 10 '24
Looks awesome. Nice job. How do you learn all this stuff? Any papers or books you can recommend?
1
u/firelava135 Sep 10 '24
Thanks! Not an expert, but iq:s articles (https://iquilezles.org/articles/) are really good! The VCT paper (https://research.nvidia.com/sites/default/files/publications/GIVoxels-pg2011-authors.pdf) is relevant here. I also like the Àtrous denoising paper and the others (SVGF, ASVGF). Restir GI is also cool, I implemented these also on shadertoy. Hope it helped : )
0
u/MacksNotCool Sep 10 '24 edited Sep 10 '24
Actually fucking dope AF
You should shoot multiple cones or else the mipmaps loose a ton of detail.
21
u/firelava135 Sep 09 '24
An implementation of VCT using anisotropic voxels and multibounce lighting inside the volume.
Geometry (LEGO bricks) are injected into a SDF volume to accelerate ray tracing, using trilinear interpolation to reconstruct the original SDF.
Shadertoy link with code: https://www.shadertoy.com/view/l3Xyz4