The Black Hole — Real Geodesics, Real Doppler, Real Photon Ring
A Schwarzschild black hole where light is actually integrated through curved spacetime. The accretion disk wraps over the top because photons orbit. Doppler shift, gravitational redshift, photon sphere — all real.
What this is
For every pixel on screen, a light ray is integrated backwards through the Schwarzschild metric using 4th-order Runge-Kutta with 220 steps. Some rays hit the accretion disk, some fall past the event horizon, some escape to a procedural starfield. Doppler beaming brightens the side of the disk moving toward the camera. Gravitational redshift dims and reddens light leaving the deeper potential well. The photon sphere at r = 1.5·R_s appears as a bright ring because grazing rays orbit before escaping.
Why this is mind-blowing
Most "black hole" demos cheat with image-based screen distortion. This one actually solves the geodesic equation. The wrapped disk — the iconic Interstellar/Gargantua look — isn't a special effect, it's what photons do when they orbit a gravitating mass. You wrote one paragraph of prompt and the model produced a real-time numerical solver for general relativity in a fragment shader.
Build a single-file WebGL demo of a Schwarzschild black hole with an
accretion disk. Use real geodesic ray-tracing — for every screen pixel,
integrate a light ray backwards through curved spacetime until it either
hits the disk, falls past the event horizon, or escapes to the sky. The
disk should appear wrapped over the top of the hole because photons
orbit. Add Doppler shift and gravitational redshift to the disk color.
The photon sphere should be visible as a bright ring. No fake bend —
actual numerical integration of the Schwarzschild geodesic equation.
Paste this into Claude, Cursor, or Copilot. Change one thing that matters to you.
What I learned shipping it
- Schwarzschild geodesics conserve angular momentum h = |r × v|. That single conservation law lets you reduce the 3D problem to 2D per ray and integrate it with classical RK4 in a fragment shader.
- Adaptive step size — slow near the horizon, fast at large r — is the difference between burning your GPU and not. Make dλ a function of r.
- The wrapped accretion disk and the photon ring aren't features you add. They emerge naturally from the integration. The model knows the equations, but you have to ask for the equations, not the appearance.