Recently I finished building another thing™ that’s been on my mind for a long time. It’s a simulation of a simple real-world environment, except for one important difference: the speed of light in this environment is extremely slowed down to exactly 5 kilometers per hour, a brisk walking speed. With this crucial difference, we’re able to observe relativistic effects at more human scales, thereby developing a better intuition of what actually happens when an observer approaches the speed of light relative to their surroundings.

This was largely inspired by MIT’s OpenRelativity project, which was released around 2012, and is intended for use in the Unity engine. I, however, wanted to make something much more lightweight: plain javascript and WebGL, usable in a web app. I also wanted to make it as physically accurate as possible, while maintaining fairly good performance, paying particular attention to relativistic Doppler effects (redshift, blueshift, transverse effects) and effects from light travel delay such as Terrell rotation and temporal Doppler nuances, the latter of which OpenRelativity seems to neglect.

Naturally I made heavy use of LLMs in building this simulation (Claude Opus 5), but this was only due to my inexperience with OpenGL, not any inexperience with the mathematics of special relativity. In fact, before anyone concludes that LLMs “understand” special relativity, I will note that I had to steer and re-prompt the LLM numerous times with the proper equations to get it to work properly.

Something remarkable about this kind of simulation is that the mathematics is really not very complicated; most of it is high school level algebra. So as long as we get the math right, all of the various effects and strange phenomena emerge automatically. The thing that continues to boggle my mind, and the thing that I appreciate even deeper after finishing this app, is how Einstein could have envisioned this geometry and all its implications from first principles, without the benefit of pretty visualizations. For the rest of us, I hope this visualization can serve as a reminder of how weird our world actually is, at high enough speeds and high enough energies.

Check it out, and let me know if anything appears inaccurate, or if you’d like to see any additional features!
(on Hacker News)



