Newtonian Sandbox

UPDATE 05-05-2014

I’m still working on gravity, adjusting some velocities, masses, distances and timescale to get realistic behaviors.

This experience is a part of a game prototype, “Birth and Death of Stars”. I though it would be cool to be able to select some elements from the periodic table and drop into empty space. Based on Newton’s law, these elements start attracting each other to form stars (red small ones, blue giants, …). Then, these stars can turn to supernova and they can also end into white dwarf, neutron star, even black hole, depending the amount of matter used or added during the game…

Here you can see how it’s running in real-time in Unity. There is a little frame drop due to video recording but the output is still OK. My graphic card is a Nvidia GTX 590 with 1024 CUDA cores.


A few numbers:
Max nbody particles: 25.000.
Emitted particles random mass between 1 and 1.000 units.
The black hole itself has a start mass of 12.000.000 units and get heavier when it swallow stars.
Each mouse click releases 150 “stars” per frame.

As this experience is fully running on GPU and asking a lot of work from the cores, I was not able to record the video in 1080p without significant frame drops :/



I was already fascinated by the power of stars when I was a little boy.
With Computer Graphics technology, I can now simulate at home, in very small scale, what I always wanted to see and to play with.

As experiences with Newtonian Physics require heavy exponential operations, I started to use a perlin noise algorithm through a Compute Shader to get not accurate but interesting results. It’s completely real-time and you can handle the different exploding phases of the star and moving around it with your mouse.

I though about adding sliders to control mass, size, core temperature… and a command to ignite the star collapsing phase. We’ll see.


QNewtonian Sandbox

1 comment

Join the conversation
  • Avatar

    JoergZdarsky - September 17, 2014 reply

    Very nice. I am planing to add a black hole in my space simulator. You effect looks top, although i need a more lightweight effect to keep resources for other things. However it looks great, impressive work, and for me inspiring for my own developments!!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.