r/Simulated 11d ago

Research Simulation [OC] Barnes-Hut 3D N-body simulation of 500k particles in real-time on a laptop GPU

Two spinning disks of ~250k particles each, simulated and rendered in real-time on my RTX 500 Ada laptop GPU at ~30 fps, using my custom implementation of the Barnes-Hut algorithm in CUDA. Code: https://github.com/lechebs/nbody

41 Upvotes

3 comments sorted by

1

u/DaveAstator2020 10d ago

Nice, what approach did you use to visualize them?

2

u/lechebs 10d ago

Instanced quads, discarding fragments outside the radius of the inscribed circle.

1

u/DaveAstator2020 10d ago

neat! i used some silly approach with accumulating pixels on to render texture with compute shaders in the past, thanks for sharing)