About Gravity Simulator
Gravity Simulator — also known as Harmony of the Spheres — is an interactive, browser-based N-body simulation engine. It models the gravitational interactions between any number of bodies in real time, from the familiar orbits of our Solar System and catalogued exoplanets to speculative scenarios such as the Earth falling into Saturn's rings.
Planetary surfaces, atmospheres, and starlight are rendered in three dimensions as you watch orbits evolve. All physics runs entirely in your browser — no server, no plugin, and no installation required. The project is open source under the GNU GPL v3 and has been developed since 2018 by Darrell A. Huffman.
Scenario library
The library contains more than 4,400 ready-to-run simulations organised into four categories. Most orbital data comes from the NASA Exoplanet Archive and JPL HORIZONS. See the Credits page for a full list of data sources and contributors.
4,397
Exoplanetary systems
Confirmed exoplanet systems from the NASA Exoplanet Archive — from single-planet hosts to TRAPPIST-1's seven worlds. Each system is built from published orbital elements.
20
Solar System
Moon systems, asteroid families, the Kuiper Belt, near-Earth asteroids, interstellar visitors like 'Oumuamua and Borisov, and the Pentagram of Venus — all from JPL HORIZONS ephemerides.
11
N-body choreographies
Periodic solutions to the gravitational N-body problem — the Figure Eight, Four Corners, Star of David, and other mathematically exact orbital dances.
6
What-if scenarios
Hypothetical situations such as the Earth falling into Saturn's rings, the Nice Model of Solar System formation, and the search for Planet Nine.
Features
Ready-made scenarios
Browse more than 4,400 simulations spanning the Solar System, moon systems, asteroid families, exoplanetary systems, interstellar objects, and hypothetical scenarios — most built from real orbital data.
Procedural planetary surfaces
Many worlds are rendered with WebGL shader textures generated on the fly from each body's mass, orbit, and stellar environment. Lava worlds, habitable coastlines, deserts, ice giants, and gas giants each pick palettes and terrain noise unique to that body.
Newtonian N-body physics
Every body exerts a gravitational pull on every other. Choose from fourteen numerical integrators — including RK4, Verlet, PEFRL, and high-order symplectic methods — or use the Orbital Elements integrator for hierarchical systems.
Tunable physics engine
Adjust the gravitational constant G (including negative values for repulsive gravity), set a softening constant for close encounters, enable Barnes–Hut tree approximation for large systems, and use adaptive time-step integrators with error tolerance control.
Add and modify masses
Inject new bodies into any running simulation from fifty real-object templates — stars, planets, moons, dwarf planets, and asteroids — or specify custom mass and radius. Edit orbital elements live and remove bodies to see how orbits respond.
Particle ring systems
Many scenarios include tens of thousands of ring particles, each governed by gravity. Build your own ring configuration around any body, or watch Saturn's rings interact with a passing mass.
Collision detection
When two bodies get close enough, they merge and conserve momentum. Impact shockwaves ripple across the surviving body's surface in real time.
Flexible camera
Lock the camera to any body or the system barycenter, switch rotating reference frames mid-simulation, and orbit the scene freely in three dimensions.
Barycenter and Lagrange points
Visualise the system's centre of mass and the five Lagrange points for any chosen pair of bodies — the gravitational sweet spots where a small body can maintain a stable position.
Graphics controls
Toggle orbital paths, motion trails, body labels, and the stellar background independently. Starlight follows the inverse-square law with colour derived from each star's temperature.
Save, load, and reset
Save modified scenarios to your browser's local storage, reload them later, or reset any simulation to its original state without refreshing the page.
Custom scenario builder
Create your own star system from scratch — pick a stellar mass, choose an integrator, configure graphics options, and launch a simulation tailored to your experiment.
Built with
Gravity Simulator is a static site built with Gatsby and React, with 3D rendering powered by Three.js and WebGL shaders. Simulation state is managed with Redux, and every scenario is a JSON file processed at build time. The source code is available on GitHub.