I've just tried to implement gravity simulation in rust (8 cores, simple n**2 algorithm with Euler's integration) and got ~55 ms per step (18 fps) for 10k particles. After that re-implemented the sim using pytorch tensors. On 4090 10k ~ 5 ms sim + 3 ms rendering. Managed to push it up to 35k, before running out of mem, got 60 ms per frame (16 fps). P. S. Measurements were collected for 3D sim.
Impressive! It would be cool if you simulated collisions to see if you could get something that resembled disk-shaped galaxies, since discs are essentially the shapes they will take on given enough time when the collisions are plastic. Did you implement Barnes-Hut? Not that I have implemented any of these algorithms myself, but there is an algorithm called fast multipole method (FMM) that is supposed to be able to simulate each time step in O(n) time. Maybe it can give you a small performance boost (but I guess n needs to be over a certain threshold for it to start to be faster than Bernes-Hut).
I've just tried to implement gravity simulation in rust (8 cores, simple n**2 algorithm with Euler's integration) and got ~55 ms per step (18 fps) for 10k particles.
After that re-implemented the sim using pytorch tensors. On 4090 10k ~ 5 ms sim + 3 ms rendering.
Managed to push it up to 35k, before running out of mem, got 60 ms per frame (16 fps).
P. S. Measurements were collected for 3D sim.
Impressive! It would be cool if you simulated collisions to see if you could get something that resembled disk-shaped galaxies, since discs are essentially the shapes they will take on given enough time when the collisions are plastic.
Did you implement Barnes-Hut? Not that I have implemented any of these algorithms myself, but there is an algorithm called fast multipole method (FMM) that is supposed to be able to simulate each time step in O(n) time. Maybe it can give you a small performance boost (but I guess n needs to be over a certain threshold for it to start to be faster than Bernes-Hut).
i see FFT I run away
@@tucan7112It doesn't use FFT. It's kind of similar to Barnes-Hut.
4E looks more sparse, but probably because of the perspective effect.
Ever tried to use slicing with ghost shadows? Or mapping the w axis to a color?
Here I just clipped near plane for the 4D camera.
Sweet!