2D, 3D, 4D gravity simulation

Поділитися
Вставка
  • Опубліковано 7 вер 2024

КОМЕНТАРІ • 7

  • @sirynka
    @sirynka 2 місяці тому

    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.

  • @kristoferkrus
    @kristoferkrus 8 місяців тому +4

    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).

    • @tucan7112
      @tucan7112  8 місяців тому

      i see FFT I run away

    • @kristoferkrus
      @kristoferkrus 8 місяців тому

      @@tucan7112It doesn't use FFT. It's kind of similar to Barnes-Hut.

  • @totoshampoin
    @totoshampoin 8 місяців тому +2

    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?

    • @tucan7112
      @tucan7112  8 місяців тому

      Here I just clipped near plane for the 4D camera.

  • @NonEuclideanDreamer
    @NonEuclideanDreamer 8 місяців тому

    Sweet!