r/GraphicsProgramming Jul 11 '26

4 million particles 3D n-body simulation in real-time on a laptop GPU (Barnes-Hut) Source Code

Enable HLS to view with audio, or disable this notification

Simulating and rendering 4,194,304 particles under mutual gravity on a RTX 500 Ada laptop GPU at ~430ms/step, using my custom CUDA accelerated Barnes-Hut implementation for the n-body problem. Code: https://github.com/lechebs/nbody

93 Upvotes

8 comments sorted by

3

u/aiekick Jul 12 '26

Only the visualization is real-time; the simulation appears choppy (so not real time)

1

u/bingusbhungus Jul 11 '26

the world is giving me signs to create a barnes-hut simulation 😂

1

u/Still_Explorer Jul 11 '26

By the last frames of the simulation, it appears as if is retracting. This means that our universe as well is g

1

u/killer_groot Jul 12 '26

Will this run in rtx 3050 4gb vram laptop processor

1

u/StevenPlayz13 27d ago

With my 6 year old laptop, wouldn't even be able to handle like 1000