Oh one question I have, when I messed around with ThreeJS line width was a problem, these curves look pretty nice/thick on mac, maybe that was updated recently. (lines as in orbit path)
ThreeJS is awesome btw, I exported a GDB file I think from a CAD program and imported it into ThreeJS/able to animate each part pretty cool.
ge96
My dumb question: I thought the whole thing with this is the instability/inability to predict. It starts off with the three bodies locked in to fixed motions? I guess it has to be for the user to start messing around with it?
show comments
emmanueloga_
Tried writing an electrostatic particle simulator in Turbo Pascal 7 with BGI as a teen, a handful of particles before it crawled. Then saw a galaxy collision sim on a CD-ROM magazine disc handling thousands of bodies smoothly. Thought it was assembly tricks.. now I'm sure it's algorithmic (avoiding N**2 runtime) but never dug into the specifics. Are charges vs gravity sims essentially the same n-body problem?
show comments
ralferoo
One thing I'd never really considered before is how frequently bodies get ejected at high speed from the simulation, especially as the number of initial bodies is increased. Suddenly made me realise that the "big bang" which previously seemed a bit of a random and magical theory (obvious question is why would the universe be expanding from a single point when gravity would be immense) now seems a lot more plausible without needing any "magic" to justify it.
This browser-based interactive 3D Three‑Body problem simulator is super cool—beautiful visuals + real physics chaos. It’s a fun way to see how three gravitational bodies interact, and the ability to tweak initial conditions makes the chaos feel almost magical.
show comments
oskarkk
Looks very nice!
I think I found a bug: after pausing, moving a body and unpausing, I cannot move the camera. Changing "follow" to something and back to "none" helps.
hermitcrab
Excellent work. Is this based on simple Newtonian gravity applied over a uniform time-step, or something more sophisticated?
show comments
phkahler
How about a perturb button so those special stable orbits can be nudged just enough to destabilize them.
show comments
grumbelbart2
I triggered some bug by pausing the simulation, setting the mass of one of the objects to 29.1, then resuming. The lighter objects bounced into the massive objects a few times, then all three objects were suddenly ejected with a very high velocity.
TMEHpodcast
This is really lovely work! Simple to use, surprisingly solid, and just a pleasure to poke around with. The fact it runs in the browser is a bit of magic on its own.
One idea for later might be a few preset systems, such as Alpha Centauri or other known three-body systems. It would give people a quick way to drop into something real before they start making chaos of their own.
Anyway, cracking project.
show comments
gorgoiler
I didn’t realize something until I used this simulation: with three bodies you can eject one body in one direction and the barycentre of the remaining two in another. This means that compared to the original frame of reference you have an orbiting pair that moves.
It’s one of those things that seems so obvious and yet actually seeing it is a really important step in understanding.
show comments
westurner
Will this simulate the sun and planets of the solar system?
Do these models of n-body gravity predict the perihelion in the orbit of Mercury?
Newton's does not predict perihelion, GR General Relativity does, Fedi's SQG Superfluid Quantum Gravity with Gross-Pitaevskii does, and this model of gravity fully-derived from the Standard Model also predicts perihelion in the orbit of planet Mercury.
Lagrange points like L1 and L2 are calculated without consideration for the mass of the moon.
Were you by any chance inspired to make this because of the three body series by Cixin Liu? Or were you moreso just inspired because the simulation/math/physics are interesting?
show comments
brna-2
Starting out with the stable preset I had no idea how hard it would be to not make a object slingshot out. But it is a really fun sim, I think I will let my kid play with it.
chombier
Nice! It would be interesting to visualize the total momentum vector, IIRC Verlet being symplectic should be good at preserving symmetries, whereas RK4 is good at conserving energy.
MrQianjinsi
So beautiful, I once had a similar idea, and I'm glad to see someone bring it to life
I spent a long time playing with the sim. Nice work.
Most of the random data sets that I ran ended up with a two body system, where the third body was flung far into space never to return. However, some of these were misleading. I had one running for 15 minutes at 5x, and the third body did eventually return.
show comments
Mikhail_Edoshin
I recently thought that if life supposedly happened by chance then it should be same for the three-body problem: naturally occurred solutions floating here and there somewhere.
show comments
Ethan312
The 3D presets are the standout here, especially the ones that move in and out of the orbital plane. The interaction feels smooth, and it’s great to see this level of detail running in the browser.
sbinnee
I really enjoyed the book series. This is an amazing work! Thanks for sharing.
kapitanjakc
No physics expert but isn't this unpredictable (based on what I saw in series) ?
Amd this does seem predictable, I saw this for almost a minute
Simulating a four-body problem from the point of view of a telluric planet being juggled around by three stars. It's supposed to emulate the evolution of trisolarans from the "Three Body Problem" novel by Liu Cixin.
lutusp
> Open to suggestions for additional presets or features!
Anaglyphic (red/cyan) 3D rendering would be nice. I've created a lot of anaglyphic 3D apps over the years, but they're no longer very popular -- I suspect it's the goofy glasses one must acquire and wear.
But a true 3D view of an orbital simulator like this greatly increases its impact and tutorial value.
deafpolygon
nice simulator…
one issue i have always had with the n-body calculations is how can you be sure there is exactly n?
jjmarr
Is this with Gemini 3?
show comments
kona358
fuck this is so cool. im currently reading deaths end from the three body trilogy and seeing the physical representation is so cool. Makes a certain moment in deaths end seem awesome.
Oh one question I have, when I messed around with ThreeJS line width was a problem, these curves look pretty nice/thick on mac, maybe that was updated recently. (lines as in orbit path)
ThreeJS is awesome btw, I exported a GDB file I think from a CAD program and imported it into ThreeJS/able to animate each part pretty cool.
My dumb question: I thought the whole thing with this is the instability/inability to predict. It starts off with the three bodies locked in to fixed motions? I guess it has to be for the user to start messing around with it?
Tried writing an electrostatic particle simulator in Turbo Pascal 7 with BGI as a teen, a handful of particles before it crawled. Then saw a galaxy collision sim on a CD-ROM magazine disc handling thousands of bodies smoothly. Thought it was assembly tricks.. now I'm sure it's algorithmic (avoiding N**2 runtime) but never dug into the specifics. Are charges vs gravity sims essentially the same n-body problem?
One thing I'd never really considered before is how frequently bodies get ejected at high speed from the simulation, especially as the number of initial bodies is increased. Suddenly made me realise that the "big bang" which previously seemed a bit of a random and magical theory (obvious question is why would the universe be expanding from a single point when gravity would be immense) now seems a lot more plausible without needing any "magic" to justify it.
Suggestion: add a preset for a configuration of the Painleve conjecture. https://en.wikipedia.org/wiki/Painlev%C3%A9_conjecture
This browser-based interactive 3D Three‑Body problem simulator is super cool—beautiful visuals + real physics chaos. It’s a fun way to see how three gravitational bodies interact, and the ability to tweak initial conditions makes the chaos feel almost magical.
Looks very nice!
I think I found a bug: after pausing, moving a body and unpausing, I cannot move the camera. Changing "follow" to something and back to "none" helps.
Excellent work. Is this based on simple Newtonian gravity applied over a uniform time-step, or something more sophisticated?
How about a perturb button so those special stable orbits can be nudged just enough to destabilize them.
I triggered some bug by pausing the simulation, setting the mass of one of the objects to 29.1, then resuming. The lighter objects bounced into the massive objects a few times, then all three objects were suddenly ejected with a very high velocity.
This is really lovely work! Simple to use, surprisingly solid, and just a pleasure to poke around with. The fact it runs in the browser is a bit of magic on its own.
One idea for later might be a few preset systems, such as Alpha Centauri or other known three-body systems. It would give people a quick way to drop into something real before they start making chaos of their own.
Anyway, cracking project.
I didn’t realize something until I used this simulation: with three bodies you can eject one body in one direction and the barycentre of the remaining two in another. This means that compared to the original frame of reference you have an orbiting pair that moves.
It’s one of those things that seems so obvious and yet actually seeing it is a really important step in understanding.
Will this simulate the sun and planets of the solar system?
Do these models of n-body gravity predict the perihelion in the orbit of Mercury?
Newton's does not predict perihelion, GR General Relativity does, Fedi's SQG Superfluid Quantum Gravity with Gross-Pitaevskii does, and this model of gravity fully-derived from the Standard Model also predicts perihelion in the orbit of planet Mercury.
Lagrange points like L1 and L2 are calculated without consideration for the mass of the moon.
Additional notes on n-body mechanics: https://westurner.github.io/hnlog/#comment-45928486 Ctrl-f n-body, perihelion
This is amazing! Nicely done!
I did something similar, mostly 2D here:
https://www.nhatcher.com/three-body-periodic/
(Mine is just unfinished)
Nice work!
Were you by any chance inspired to make this because of the three body series by Cixin Liu? Or were you moreso just inspired because the simulation/math/physics are interesting?
Starting out with the stable preset I had no idea how hard it would be to not make a object slingshot out. But it is a really fun sim, I think I will let my kid play with it.
Nice! It would be interesting to visualize the total momentum vector, IIRC Verlet being symplectic should be good at preserving symmetries, whereas RK4 is good at conserving energy.
So beautiful, I once had a similar idea, and I'm glad to see someone bring it to life
Super cool!
I've been working on some n-body code too, currently native only though: https://www.youtube.com/watch?v=rmyA9AE3hzM
Any github?
I spent a long time playing with the sim. Nice work.
Most of the random data sets that I ran ended up with a two body system, where the third body was flung far into space never to return. However, some of these were misleading. I had one running for 15 minutes at 5x, and the third body did eventually return.
I recently thought that if life supposedly happened by chance then it should be same for the three-body problem: naturally occurred solutions floating here and there somewhere.
The 3D presets are the standout here, especially the ones that move in and out of the orbital plane. The interaction feels smooth, and it’s great to see this level of detail running in the browser.
I really enjoyed the book series. This is an amazing work! Thanks for sharing.
No physics expert but isn't this unpredictable (based on what I saw in series) ?
Amd this does seem predictable, I saw this for almost a minute
There is also this fun website: https://labs.sense-studios.com/threebody/index.html
Simulating a four-body problem from the point of view of a telluric planet being juggled around by three stars. It's supposed to emulate the evolution of trisolarans from the "Three Body Problem" novel by Liu Cixin.
> Open to suggestions for additional presets or features!
Anaglyphic (red/cyan) 3D rendering would be nice. I've created a lot of anaglyphic 3D apps over the years, but they're no longer very popular -- I suspect it's the goofy glasses one must acquire and wear.
But a true 3D view of an orbital simulator like this greatly increases its impact and tutorial value.
nice simulator…
one issue i have always had with the n-body calculations is how can you be sure there is exactly n?
Is this with Gemini 3?
fuck this is so cool. im currently reading deaths end from the three body trilogy and seeing the physical representation is so cool. Makes a certain moment in deaths end seem awesome.