Interactive demo
Black Hole Shader
A black hole rendered live on your graphics card: every pixel traces a ray of light through curved spacetime, past a glowing, rotating accretion disk.
Drag to fly around the black hole. Look at the disk from close to its edge to see its far side bend over the top.
Camera
Accretion disk
Display
1. Bending light
Every pixel follows a light ray backwards from the camera, step by step. Near the black hole gravity bends the rays: stars behind it appear distorted, and some rays circle it before they escape. The shader uses the Schwarzschild solution of a non-rotating black hole; distances are measured in Schwarzschild radii, the radius of the event horizon.
2. The accretion disk
Hot gas orbits the black hole in a disk that starts at three Schwarzschild radii, the innermost stable orbit. Where a ray passes through it, the shader samples the gas in small steps: it glows and absorbs light like a cloud. Inner rings orbit faster than outer ones, which stretches the clouds into long filaments. Because light bends, the far side of the disk also shows up above and below the black hole.
3. Doppler beaming
Gas moving towards you looks brighter and bluer, gas moving away dimmer and redder, so one side of the disk glows much stronger. Light climbing out of the gravity well also loses energy: the gravitational redshift.
Credits
- The volumetric, cloud-like accretion disk is inspired by the video “Using Raymarching to create a Black Hole” by Rodrigo Gonzalez.
- The light bending follows the method of the black hole raytracer “Starless” by rantonels, which traces light as a particle in a simple force field.