Kshitij Sarve All work
05 · Just for fun170M rays/s

Horizon: real-time black hole renderer

A GPU renderer that traces light around a spinning black hole. A physics experiment built for fun, pair-programming with an AI coding agent.

Key decision

Trust, but verify: the analytic shadow outline is drawn over the ray-traced image, and 68 physics tests check the GPU against the CPU.

My contribution

Built a physics renderer as a side project, pair-programming with an AI coding agent.

The constraint

A convincing image must also agree with the underlying physics.

How it works

C++20 and GPU shaders trace light through the equations of a spinning black hole, producing the shadow, lensed starfield and Doppler-shifted disk. An analytic shadow outline and 68 physics tests compare GPU results with CPU calculations.

The result

A real-time renderer with a reported throughput of 170M rays/s and explicit physics checks.

Stack

  • C++20
  • OpenGL / GLSL
  • WebGL2
Watch the animation