A 3D spacetime grid deforms under the gravitational influence of placed planetary bodies, with PBR-rendered spheres warping the mesh surface in a real-time BabylonJS simulation.
Hitesh Sahu, a senior developer at Thoughtworks, built a spacetime sandbox and put it in your browser. His General Relativity Physics Simulation lets you drop planets onto a grid and watch gravity do what gravity does: warp the fabric underneath, pull neighbors into wobbly orbits, and occasionally swallow things whole. It's the rubber-sheet analogy from your physics textbook, except the sheet actually moves, the masses have PBR materials that catch light like real objects, and collisions make satisfying little sounds when worlds meet. You place things. The universe responds. There is something deeply pleasing about that loop.
Under the hood, this runs on BabylonJS with Ammo.js handling the physics simulation. That pairing does a lot of heavy lifting here. The spacetime mesh deforms in real time based on mass proximity, which means the grid isn't decorative; it's doing actual work, visually encoding gravitational potential as surface curvature. The collision audio is a nice touch that most physics demos skip entirely. It's a small detail that makes the whole thing feel less like a visualization and more like a toy in the best possible sense.
Go ahead and give it a whirl. Drop planets onto a deformable spacetime mesh and watch gravity do its thing.
- Live Demo: https://hiteshsahu.com/lab/relativity
- Author: Hitesh Sahu (LinkedIn, X, GitHub)