Gravitational lensing — gravitational lensing simulation
Inverse ray-tracing through a Schwarzschild deflection — the cursor is the lens, distorting a starfield. Click stacks a mass pulse.
How it works
Procedural milky-way field pre-rendered at 2× into an offscreen canvas.
Inside a box around the hole, inverse-ray-trace each pixel through the Schwarzschild deflection β = θ − (θ_E²/|θ−h|²)(θ−h) multiplied by quadratic falloff (1 − r²/R_c²)² that zeroes at R_c = 3.2·θ_E. 2×2 bilinear sample for AA. Shadow at 3.8% × min(W,H), θ_E = 2.6·shadow_r.
Cursor controls position. Click stacks a mass pulse (×2, capped at 4×, decay 0.992^(dt/16.67) per frame). Idle → Lissajous drift.