galaxy

Newtonian Universe Simulation

I’ve been using PopcornFX a lot lately and have been using it as a playground to explore some simple physics simulation. For example Hooke’s law and compressible springs:

And it was pretty fun exploring Newton’s law of universal gravitation with a classic “orbit” simulation:

But then it occurred to me… PopcornFX is pretty efficient, why not scale up my basic simulation to handle not only a few orbiting bodies, but hundreds of thousands? While not correct to the universe we live in the result should look a bit like elliptical galaxies, right?

Let’s try it.

Ok then, here’s a screenshot of a sim of around 900k particles, running 30-50ms per frame. Too slow for game work but pretty fast for cinematics, and PKFX is integrated into After Effects so I really should try rendering out a movie.

In motion the effect is mesmerizing, with “galaxies” merging, splitting, devouring each other and for some reason periodically seeming to explode into rope-like strands. Nowhere near physically correct of course, but evocative of space imagery and very beautiful. 

Why no spiral galaxies? In the real world a lot more is going on, with gasses compressing and angular momentum preserved. This little simulation doesn’t account for more than the most basic, crude motion so, alas, the “galaxies” which form are elliptical only and rarely stable for very long.