Gargantua · How it works

How the black hole is computed

Nothing in the simulation is drawn by hand. Every pixel is a ray of light traced backwards through the curved spacetime of a spinning black hole, with the same equations the visual effects team of Interstellar used, live, in your browser.

Open the simulation Source code

5.19615 Msize of the shadow of a non-spinning hole, as traced. The formula, √27 M, gives 5.19615.
3.83849 Medge of a spinning hole's shadow (a = 0.6), as traced. The exact Kerr value is 3.83850.
1,877 / 1,877rays the fast "will it fall in?" test got right, checked against a precise integrator.
0.002 Mlargest error of the falling camera against the exact free-fall curve.
The black hole Gargantua from the simulation: a black shadow with a thin bright ring, the glowing disk crossing in front and bent over the top and under the bottom.
The simulation at 26 M (mass units, see below), film look. The disk is flat: its far side shows above and below the hole because its light is bent over the top and under the bottom.

01 · The spacetime

A spinning black hole, written so the horizon isn't a wall

A spinning black hole is described exactly by one solution of Einstein's equations, found by Roy Kerr in 1963. It has two numbers: the mass M and the spin a (0 = not spinning, 1 = the fastest possible). Distances are measured in M: for Gargantua, 100 million times the Sun's mass, 1 M is about 150 million km, the distance from the Earth to the Sun. The film's Gargantua spins at a = 0.6.

The usual way of writing the solution (Boyer–Lindquist coordinates) breaks at the horizon: numbers blow up to infinity right where things get interesting, which is why most renderers stop there. This one uses the Kerr–Schild form in plain x, y, z coordinates, which stays smooth through both horizons, so the same code renders the outside, the crossing and the inside:

gμν = ημν + f lμ lν,   f = 2Mr³ / (r⁴ + a²z²)

η is flat space and l a light-like direction. A bonus of this form: its inverse is exact and cheap, gμν = ημν − f lμ lν, so no matrix has to be inverted at every step.

02 · Light

Every pixel follows one ray of light, backwards

Light moves along the straightest possible paths through curved spacetime (null geodesics). For each pixel the simulation starts a ray at the camera and runs it backwards in time until it hits the disk, falls into the hole, or escapes to the stars. The ray obeys Hamilton's equations:

H = ½ gμν pμ pν = 0,   dx/dλ = ∂H/∂p,   dp/dλ = −∂H/∂x

The same view with the stars replaced by a coloured grid. Its lines are bent into rings and arcs around the black hole.
The same view with the sky swapped for a grid of 10° squares (press C in the simulation). Every grid line is straight; every bend is the hole bending light.

03 · The camera

A real observer, with its own clock

The camera is placed the way the film's was: it rides with the local "non-rotating" observer (a ZAMO, Bardeen 1972), whose frame is built from the metric itself. When you fly, that frame is Lorentz-boosted by your speed, so the sky squeezes ahead of you exactly as special relativity says (aberration; tested).

The readout "1 h here = … on Earth" is that observer's clock against a clock far away: gravity (the lapse α) and speed (γ) together. Miller's planet in the film, where an hour is seven years, would need a spin within a hair of the maximum (Thorne, The Science of Interstellar); the trip stops there to show it.

04 · The disk

Film or reality: one choice the film made on purpose

The disk is thin gas orbiting between the last stable orbit (inside it, gas can't stay in orbit) and its outer edge, each ring at its own orbital speed, Ω = 1 / (r3/2 + a). Its colour is a real blackbody temperature turned into screen colour through the human eye's colour response (Planck × CIE 1931).

In reality the gas moving towards you would look bluer and far brighter, and the side moving away dimmer and redder: its light is shifted by g = 1 / (ut (E − Ω L)), Doppler and gravity together, and its brightness by g⁴. The film left that out, so audiences wouldn't be confused (James et al. 2015). The simulation shows the film's choice; the real one is computed too:

Film look: both sides of the disk equally bright.
Film: spin 0.6, no Doppler shift.
Reality: the left side of the disk blazes white, the right side is dim and orange; the shadow is flattened on the left.
Reality: spin 0.999, true shift. The shadow flattens on the side spinning towards you. Try it.

05 · The sky

Real stars that don't sparkle

The Milky Way is NASA's map of the real sky (Deep Star Maps 2020, from the Gaia satellite). Near the hole, lensing stretches it enormously, so each pixel works out how much sky it covers (ray differentials) and reads the image at that size. Stars are drawn as sharp points where lensing puts them, brightened by exactly how much lensing magnifies them, so their light is conserved. The thin bright ring hugging the shadow is light that circled the hole once or more; there, each pixel traces 16 rays instead of one (the film's "ray bundles", in real time).

06 · Falling in

Through the horizon, to where known physics stops

When the engine switches off, nothing is scripted: the camera follows its own free-fall path (a timelike geodesic in proper time), through the event horizon and down to the inner horizon. Looking back, the light from outside is redshifted straight behind you and blueshifted 2–8× in a bright rim around that view, as measured along the rays.

The fall ends at the inner horizon on purpose. In the ideal solution space goes on, but in a real black hole matter falling in at different times streams through itself there at almost the speed of light and its energy grows without limit ("mass inflation", Poisson & Israel 1990; Hamilton & Avelino 2010). What happens next needs a theory of quantum gravity, which nobody has yet, so the simulation stops rather than make it up.

07 · Real time

Hundreds of steps per pixel, in a browser

A full picture is about a million rays of up to 1,200 steps each. The trick is to trace only when the camera moves: the results are kept (where each ray hit the disk, where it reached the sky) and every frame only recolours them, so the disk turns and the picture stays smooth for free. While you move, rays are traced at a lower resolution, sized by the graphics card's own timers to hold the frame rate; when you stop, the full picture is traced in bands over a few frames. Edges and the photon ring are re-traced at screen resolution, and only those pixels: a stencil mask packs them together so the rest of the screen doesn't wait on them.

Measured speed
Scene (1600×900, Chrome, integrated AMD Radeon graphics)Frames per second
Standing still, picture sharp60+
Flying at 12 M (film spin)41–57
The trip (film spin)39–56
Fast spin 0.999, inside the photon shell, moving17–53
Falling through the horizon37–46
From a stop to a sharp picture~1 s

08 · Checked

Every claim has a test

The physics lives in one JavaScript file shared by the page and an automated test suite (90 tests in the site's repository, run on every change). The graphics card runs the same equations; the tests compare it with a precise 64-bit integrator.

WhatSimulationExact / reference
Shadow of a non-spinning hole5.19615 M√27 M = 5.19615
Shadow edges, a = 0.63.83849, 6.31565 M3.83850, 6.31568 (Bardeen 1973)
Shadow on screen at 30 M~370 px369 px (formula)
Horizons, last stable orbit, photon orbitsmatchBardeen, Press & Teukolsky 1972
Energy, angular momentum, Carter constant along raysconservedCarter 1968
Rays judged "falls in" early1,877 of 1,877 rightprecise integrator
Free fall from 6 M, no spinwithin 0.002 Mexact cycloid
Shrinking of the shadow when flying at itmatchspecial-relativity aberration
Disk light shift, face-on, no spin√(1 − 3/r)time dilation + gravity
Wormhole: rays that go throughexactly those with b < ρturning point r = b

09 · The wormhole

Through the wormhole, to Gargantua's galaxy

The film's wormhole near Saturn has its own paper (James, von Tunzelmann, Franklin & Thorne 2015), written so students could render it. Its shape has three numbers: the throat's radius ρ (1 km in the film), the length of its short tunnel (1% of ρ) and its lensing width, how gradually space flares out from the throat (5% of ρ: a sharp edge):

ds² = −dt² + dℓ² + r(ℓ)² (dθ² + sin²θ dφ²),   r = ρ + M [x arctan x − ½ ln(1 + x²)]

Because the wormhole is a perfect sphere, every ray stays in one flat plane and depends on just one angle: the angle between the pixel's direction and the throat. So instead of tracing a ray per pixel, the graphics card traces 2,048 rays per frame, one per angle, and every pixel looks its answer up. That is why the wormhole runs at over 100 frames per second, even on modest devices. Rays aimed inside the edge (impact parameter under ρ, exactly) come out in the other galaxy; those just outside wrap around the throat and show the sky behind it, stretched into a ring.

The wormhole near Saturn: a sphere showing a purple galaxy, the Milky Way's core stretched into a ring around it, Saturn with its rings above.
The wormhole from 7 km. Inside the sphere: the far galaxy (its sky is artistic; no map of it exists). Around it, the Milky Way's core stretched into a ring by the lensing. Fly through it.

Sources

Papers and data

Open the simulation