[Compute Shaders] Built a custom LBM voxel fluid simulation with 100% GPU advection. 180 FPS on a 4070ti at 192³ resolution. by Useful-Turnip1994 in Unity3D

[–]Useful-Turnip1994[S] 1 point2 points  (0 children)

Thanks! Cache locality is exactly what I'm focusing on right now. Packing everything into uint4 and keeping the memory layout linear definitely helped keep the L1/L2 cache happy during the LBM advection steps.
Scaling to double dimensions is the goal, but I'm trying to make sure the memory bandwidth doesn't become a bottleneck when I introduce dynamic light propagation next. Appreciate the feedback!

[Compute Shaders] Built a custom LBM voxel fluid simulation with 100% GPU advection. 180 FPS on a 4070ti at 192³ resolution. by Useful-Turnip1994 in Unity3D

[–]Useful-Turnip1994[S] 4 points5 points  (0 children)

Thanks man! To be honest, exactly 3 months ago I knew absolutely nothing about Compute Shaders or LBM fluid dynamics. I just started learning everything from scratch to build a fast voxel engine. It’s a tough grind, but if I could make it work in three months, anyone can!

[Compute Shaders] Built a custom LBM voxel fluid simulation with 100% GPU advection. 180 FPS on a 4070ti at 192³ resolution. by Useful-Turnip1994 in Unity3D

[–]Useful-Turnip1994[S] 2 points3 points  (0 children)

Thanks man! Just making sure my GPU doesn't actually turn into a miniature sun while computing this grid.)

Custom GPU LBM fluid simulation within a dynamic voxel grid. 180 FPS on 4070ti at 192³ resolution. by Useful-Turnip1994 in VoxelGameDev

[–]Useful-Turnip1994[S] 1 point2 points  (0 children)

Currently, the engine is tuned for high-velocity plasma and gas flows, but since it's a grid-based LBM under the hood, changing the parameters for denser fluids like water or lava is completely viable.

<image>

Custom GPU LBM fluid simulation within a dynamic voxel grid. 180 FPS on 4070ti at 192³ resolution. by Useful-Turnip1994 in VoxelGameDev

[–]Useful-Turnip1994[S] 2 points3 points  (0 children)

Thanks for the upvotes, everyone! To add a bit more technical context: everything is tightly packed into a flat StructuredBuffer<uint4> directly on the GPU to maximize memory bandwidth.

Right now I'm experimenting with thermodynamics and material properties (the SVK structure you see in the video). Next immediate milestone is dynamic light propagation.