@milesgurule-png4
Miles GuruleFounder▲20
Founder, Forge Labs
Oct 23 · AI Engineering, Testing and Evals · 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.

Comments2

  • @ryanallis
    Ryan Allis
    Founder of AI Lounge and SaasRise, helping founders reach $100M+ exits
    6d ago

    One script tag to put a working black hole on any web page means a science teacher or a planetarium website could use this without hiring a developer. Because the side moving toward you glows brighter and bluer straight from the physics, students get something real to point at instead of just a pretty picture.

  • @milesgurule-png
    Miles Gurule
    15 · Founder of Forge Labs · I built an AI sales team that finds local businesses, designs their new site, and plans my walk-in route
    6d ago

    I hadn't thought of classrooms, but that's a great fit. The Doppler side is the kind of thing that's hard to picture from a textbook. I might add a mode that labels the parts.

Log in to join the thread.