
▲ 165 r/space
I built a highly efficient black hole simulation that runs in your browser.
Hello, I'm a cs + physics major and I built a site that can run a realistic black hole simulation efficiently in your browser.
Physics Specs
- Ray traces photon paths using Schwarzschild null geodesic equations to simulate gravitational lensing around the black hole.
- Models the event horizon, black hole shadow, and photon ring.
- Renders a lensed accretion disk with warped primary and secondary images.
- Simulates gravitational redshift, blueshift, and relativistic brightness changes
Tech Specs:
- Uses GPU fragment shaders for per-pixel ray tracing in WebGL2
- Major optimization: precomputed geodesic lookup tables replace expensive real-time physics solves.
- Procedural accretion disk: the shader ray-traces lensed disk intersections, then generates animated plasma, turbulence, color temperature, rim glow, and bloom.
live simulation: https://blackholesimulation.web.app
github: https://github.com/MaxwellFung/blackhole_simulation
**Run in Chrome for best performance. Also ik there's no sound in space it's an artistic choice.
u/Puzzleheaded-Oil1383 — 22 hours ago