@milesgurule-png
Miles GuruleFounder▲12L4
Founder, Forge Labs
5h ago · Discussion in AI Engineering · Franklin

I wrote a real black hole ray tracer that runs in the browser (open source)

I built <black-hole>, a web component that ray-traces a Schwarzschild black hole live in the browser. Light paths are integrated step by step (RK4), so the Einstein ring, the lensed accretion disk and the bent stars come out of the physics instead of being painted on.

  • Drop-in: one script tag, then <black-hole>
  • Disk colour comes from blackbody temperature plus Doppler beaming (the side moving toward you is brighter and bluer)
  • Fixed pixel budget, so it stays smooth on Retina screens
  • Drag to orbit, scroll to zoom, MIT licensed

Demo: milesgurule-png.github.io/event-horizon Code: github.com/milesgurule-png/event-horizon

Built it with Claude Code. The hardest bug was the whole image rendering upside down from one sign in the camera's up vector. Feedback on performance on your machine is very welcome.

0 comments

Log in to join the thread.