Relativistic Ray Tracing
An illustrated guide to black holes and relativity

Light, bent by spacetime

How does a black hole work, and what would one really look like? Eleven short lessons explain, with animated diagrams. Then four real-time simulations let you fly around a black hole and fall into one, through a wormhole and close to the speed of light. Every pixel is a ray of light, traced through curved spacetime.

Part One

How black holes work

A black hole is the simplest object in the universe, and the strangest: just a mass, a spin and a boundary nothing can leave. These eleven short lessons go from why things fall to why black holes glow. No maths needed; the equations are there if you want them.

  1. 01Gravity is the shape of spacetime
  2. 02Too heavy for light
  3. 03How a black hole is born
  4. 04The event horizon
  5. 05The photon sphere and the shadow
  6. 06The accretion disc
  7. 07Why the disc wraps over the top
  8. 08One side shines brighter
  9. 09Spin
  10. 10Spaghettification
  11. 11Do black holes last forever?
Lesson 01of 11

Gravity is the shape of spacetime

Things fall because space and time are curved.

Newton described gravity as a force that pulls masses together. In 1915 Einstein replaced the force with geometry. Mass and energy curve spacetime, the four-dimensional fabric of space and time, and everything, from planets to light, follows the straightest possible path through it. The Earth circles the Sun not because something pulls on it, but because in the curved spacetime around the Sun its straightest path closes into an orbit.

Time is part of the fabric too: clocks closer to a mass tick more slowly. The effect is small but real. Clocks on GPS satellites, further from the Earth's mass, gain about 45 microseconds a day on clocks on the ground; their orbital speed takes back 7. Ignore the difference and positions would drift by about ten kilometres a day.

Key idea

Spacetime tells matter how to move; matter tells spacetime how to curve. (John Wheeler)

Gμν = (8πG / c⁴) Tμν
1915
Einstein publishes general relativity
38 µs
net daily gain of a GPS clock
The rubber-sheet picture: a mass dents the grid and a moon rolls around the dent. It is only an analogy, since real curvature also bends time, but it captures the idea.
Lesson 02of 11

Too heavy for light

Squeeze any mass small enough, and nothing can climb out.

Throw a ball upwards and it falls back. Throw it faster than 11.2 kilometres a second, the Earth's escape velocity, and it never returns. The escape velocity depends on the mass and on how close you are to it: squeeze the Earth smaller while keeping its mass, and the escape velocity at its surface rises.

In 1783 the English clergyman John Michell asked what would happen if a star were so compact that its escape velocity exceeded the speed of light. Its light could never leave: a dark star. Einstein's theory makes the idea exact. In 1916 Karl Schwarzschild found the solution for a single mass, and in it lies a critical size, now called the Schwarzschild radius. Compress any mass inside it, and a black hole forms.

Key idea

Every mass has a Schwarzschild radius. It is about 3 kilometres for every Sun's worth of mass.

rs = 2GM / c²
Pick an object. Ordinary objects shrink to their Schwarzschild radius; real black holes are compared with orbits in our Solar System.
Lesson 03of 11

How a black hole is born

When a giant star runs out of fuel, gravity wins.

A star is a balancing act. Gravity pulls its gas inwards, and the heat of nuclear fusion in its core pushes back. When the fuel runs out, the balance fails. Stars like the Sun shrink into white dwarfs, held up by electrons that refuse to be squeezed any closer.

Stars of more than about eight Suns end in a supernova: their iron core collapses in less than a second. Usually the core becomes a neutron star. But if what is left weighs more than about two to three Suns, as tends to happen for stars of roughly twenty Suns or more, not even neutrons can hold it up, and it falls inside its own Schwarzschild radius. A stellar black hole is born, usually between 5 and 50 times the mass of the Sun.

Every large galaxy also has a supermassive black hole at its centre, millions to billions of times heavier. Ours, Sagittarius A*, weighs about 4.3 million Suns: astronomers have weighed it by following stars that orbit it, for over thirty years. How such giants grew so large, so early in the history of the universe, is still an open question.

Key idea

Black holes come in two main families: stellar ones, left by dying stars, and supermassive ones at the centres of galaxies.

~100 million
stellar black holes estimated in the Milky Way
4.3 million
Suns in Sagittarius A*, our galaxy's centre
A massive star, its core collapse, the supernova, and the black hole left behind. The timescales are wildly compressed: the star lives millions of years, the collapse takes a fraction of a second.
Lesson 04of 11

The event horizon

A boundary you can cross only once.

The Schwarzschild radius marks the event horizon. It is not a surface: an astronaut falling through would find nothing there. It is a point of no return. Outside it, a powerful enough rocket can still escape. Inside it, every possible path, even for light, leads further in.

One way to picture it is as a river. Space flows into the black hole like water towards a waterfall, faster and faster as it goes, and light swims through it at the speed of light. Far out, the current is weak and light easily swims away. At the horizon the current reaches the speed of light, and light aimed outwards stands still. Inside, the current always wins.

Time tells the same story. Seen from far away, a falling clock ticks ever more slowly as it nears the horizon, and its light grows redder and dimmer until it fades from view, apparently frozen at the edge. The astronaut holding it notices none of this, and crosses in a finite time.

Key idea

Near a mass, clocks run slow by a factor that falls to zero at the horizon.

dτ / dt = √(1 − rs / r)
The river model. Dots are space flowing inwards; arrows are flashes of light aimed outwards. Outside the horizon light makes slow progress, at the horizon it stands still, inside it is swept in.
Lesson 05of 11

The photon sphere and the shadow

Light can orbit a black hole, and the result is a hole in the sky.

At one and a half times the Schwarzschild radius, gravity bends light into a circle. This is the photon sphere. The orbit is unstable, like a pencil balanced on its tip: the slightest nudge sends the light spiralling in or flying away. If you could stand there, you would see the back of your own head.

Light arriving from far away with an aim inside a critical distance of the centre dips below the photon sphere and is swallowed. Seen from outside, all those missing rays make a dark disc: the black hole's shadow. Gravity magnifies it, so it is about 2.6 times as wide as the horizon itself. Light that only just misses circles the hole on its way past, and piles up into a thin bright ring at the shadow's edge.

In 2019 the Event Horizon Telescope, a network of radio dishes as wide as the Earth, photographed the shadow of the black hole M87*, 55 million light-years away. In 2022 it did the same for Sagittarius A*: from Earth, its ring is as big as a doughnut on the Moon would look.

Key idea

The photon sphere sits at 1.5 rs. Its shadow on the sky has a radius of about 2.6 rs.

bc = (√27 / 2) rs ≈ 2.6 rs
Light rays from the left, computed from Schwarzschild's equations. Rays aimed inside the critical distance (dashed) are captured; one that just misses loops around the hole first.
Lesson 06of 11

The accretion disc

Black holes are invisible. The gas falling into them is among the brightest things in the universe.

On its own a black hole gives off no light. What we see is matter on its way in. Gas from a companion star or from a galaxy's crowded centre cannot fall straight in: like water circling a drain, it keeps its sideways motion and settles into a flat, spinning disc.

The inner disc orbits much faster than the outer disc, so neighbouring rings of gas shear past each other. Tangled magnetic fields act like friction, heating the gas to millions of degrees and letting it slowly spiral inwards. At the inner edge it moves at half the speed of light.

That inner edge is the innermost stable circular orbit, or ISCO: three times the Schwarzschild radius for a black hole that does not spin. Closer in, no orbit is stable, and gas plunges into the horizon. Before it gets there it has turned about 6% of its mass into light, and up to about 30% around a fast-spinning hole. Nuclear fusion manages 0.7%. That is why quasars, fed by supermassive black holes, outshine their whole galaxies.

Key idea

Inner orbits are faster than outer ones, just as Mercury outpaces Neptune. Friction between them heats the gas and drains its energy.

v = √(GM / r)
6–30%
of the gas's mass turned into light
0.7%
for nuclear fusion in the Sun
The disc seen from above. Each ring orbits at its own speed, faster further in. Inside the dashed ISCO, gas spirals into the hole.
Lesson 07of 11

Why the disc wraps over the top

The famous Interstellar look is gravity acting as a lens.

Without gravity, a disc around a ball seen from the side would look like a flat ellipse, its far half hidden behind the ball. A black hole bends the light from that far half on its way to us. Light leaving the top of the far disc is bent up and over the shadow; light from its underside is bent beneath it. So we see the back of the disc twice: as an arch over the top, and a thinner one underneath.

Nothing about the disc itself is bent: it is flat and thin. Only the light is. Change your viewpoint and the image changes with it: from directly above, the far side of the disc wraps into a ring all the way around the shadow.

Key idea

A black hole is a lens: it shows you what lies behind it, stretched, magnified and often more than once.

The same flat disc, without and with the bending of light. Press the buttons to switch between them.
Lesson 08of 11

One side shines brighter

Racing gas beams its light forwards, and gravity drains its energy.

Near its inner edge the disc moves at a good fraction of the speed of light: on one side towards us, on the other away. Relativity makes this matter enormously. Light from the approaching side is shifted to bluer colours and concentrated into a forward beam, so it looks far brighter; the receding side looks redder and dimmer. Brightness grows with roughly the fourth power of the Doppler factor, so a modest change of colour is a large change of brightness.

On top of that, light climbing out of the black hole's gravity loses energy and is shifted to redder colours: gravitational redshift. The innermost gas, the hottest of all, looks cooler and dimmer than it really is.

Interstellar left all this out. Its makers kept the disc symmetric so audiences would not be puzzled by a lopsided black hole. The simulation can do either: its cinematic mode keeps a single hue, while its physical mode shifts each part of the disc by its own blackbody temperature.

Key idea

What we see depends on how fast the source moves and how deep in gravity it sits. Both are folded into one shift factor g.

Iobs = g⁴ · Iemit
A black hole in true colours, brighter and bluer on the left
True colours at spin 0.95: gas on the left moves towards us and is boosted to blue-white; gas on the right moves away and fades to orange.
Lesson 09of 11

Spin

Real black holes spin, and drag spacetime around with them.

Stars rotate, and a collapsing core spins up like a figure skater pulling in their arms. The black hole keeps that rotation. In 1963 Roy Kerr found the exact solution for a spinning black hole. The black hole in Interstellar, and the one in these simulations, is a spinning black hole of exactly this kind.

A spinning black hole drags space around with it, an effect called frame dragging. Close in, the dragging is so strong that nothing can stay still: in the ergosphere, even a rocket at full thrust is carried around with the spin. The horizon shrinks, and gas orbiting in the same direction as the spin can circle much closer before it plunges, so the disc reaches further in and shines hotter.

Spin changes the shadow too. Light passing on the side that turns towards us is helped along and can get closer, while light on the other side is held back. At high spin one edge of the shadow flattens and the whole shadow shifts sideways.

Key idea

Spin is measured by a/M, from 0 (no spin) to 1 (the fastest possible). Theory suggests real ones stop near 0.998.

r₊ = M + √(M² − a²)
A slice through a spinning black hole, seen side on. Move the slider: the horizon shrinks, the ergosphere bulges out at the equator, and a disc orbiting with the spin reaches further in, while one orbiting against it is held further out.
Lesson 10of 11

Spaghettification

Fall in feet first, and gravity pulls your feet harder than your head.

Gravity weakens with distance, so it always pulls a little harder on the near end of an object than on the far end. Across your body on Earth the difference is far too small to notice; across the Earth, the Moon's version of it raises the ocean tides. Near a black hole it becomes enormous: a falling astronaut is stretched from head to foot and squeezed from the sides, like spaghetti.

Surprisingly, small black holes are the dangerous ones. Fall into a black hole of 10 Suns and the difference between the pull on your feet and on your head would reach twenty million g at the horizon: you would be torn apart hundreds of kilometres before reaching it. At Sagittarius A*, the difference at the horizon is about a ten-thousandth of g. You would cross without feeling a thing.

Stars meet the same fate. When one wanders too close to a supermassive black hole it is pulled into a long stream of gas, and part of it falls in, lighting up a flare that lasts for months: a tidal disruption event.

Key idea

The stretching grows as the cube of how close you are. At the horizon it falls with the square of the mass.

Δa ≈ 2GM·L / r³
20,000,000 g
at the horizon of a 10-Sun black hole
0.0001 g
at the horizon of Sagittarius A*
An astronaut falling towards a small black hole is stretched along the direction of the fall and squeezed across it.
Lesson 11of 11

Do black holes last forever?

Almost. Quantum mechanics lets them glow, very faintly.

In 1974 Stephen Hawking showed that quantum effects near the horizon make a black hole give off a faint thermal glow, so it slowly loses mass. The bigger the black hole, the colder it is. One with the mass of the Sun would have a temperature of about 60 billionths of a degree above absolute zero, far colder than the 2.7 K afterglow of the Big Bang. So today every known black hole swallows more energy than it radiates, and grows.

Only in the very far future, once the universe has cooled below them, will they begin to shrink. A black hole of one Sun would take around 10⁶⁷ years to evaporate; the largest, around 10¹⁰⁰. Hawking radiation has never been observed, but it remains one of our deepest clues to how gravity and quantum mechanics fit together.

Key idea

A black hole's temperature is inversely proportional to its mass: the smaller, the hotter.

T = ħc³ / (8πGMkB)
60 nK
temperature of a black hole of one Sun
2.7 K
temperature of the cosmic microwave background
10⁶⁷ yr
for a black hole of one Sun to evaporate
Pairs of particles appear at the horizon; one escapes as Hawking radiation. This is the popular picture, and a simplification of the real calculation.
Part Two

Tracing light

To draw a black hole, you need to know where every ray of light reaching your eye came from. In flat space that is easy, because light travels in straight lines. Near a black hole, light follows the curved paths of the lessons above, so drawing it becomes a calculation.

Running the light backwards

Ray tracing follows light in reverse. From the camera, one ray per pixel is launched into the scene and stepped through the curved geometry. If it falls through the horizon, the pixel is black. If it crosses the disc, it takes the disc's glow, shifted by the Doppler effect and by gravity. If it escapes, it takes the colour of the sky in the direction it finally leaves.

Near the Sun the bending is tiny, 1.75 arcseconds for starlight grazing its edge, about half a thousandth of a degree. Near a black hole it shapes everything you see.

cameraescapes to the starsarches over the tophits the disccaptured: the shadowphoton sphere

Rays from the camera, seen from the side. Aim close to the hole and the light is captured, forming the shadow; aim a little wider and it is bent over the top, revealing the far side of the disc.

Making it real-time

Following light through curved spacetime is expensive, so the work is split: the hard part is done once, and everything that moves is cheap. That is what lets these run at full 4K in a browser tab.

  1. 01
    Trace

    For each of the 8.3 million pixels of a 4K frame, a light ray is integrated backwards through curved spacetime with a fourth-order Runge–Kutta solver, until it falls in, crosses the disc, or escapes. On a modern GPU the whole frame takes about a second.

  2. 02
    Cache

    The result is stored as a ray map: where each pixel's light came from. The wormhole and the fall into the black hole go further: their symmetry means every possible ray fits into one table, computed once.

  3. 03
    Shade

    Each frame then only looks things up: the disc's position as it rotates, its Doppler and gravitational shift, and the colour of a blackbody at that temperature, from precomputed spectral tables.

  4. 04
    Expose

    Light is kept in high dynamic range, from faint stars to the blazing inner disc, then bloomed and tone-mapped like film. The stars come from NASA's 16K HDR map of the Milky Way.

Part Three

The simulations

Four experiments to fly through. Each runs live in your browser at up to 4K; every setting can be changed, and every view can be shared as a link.

The Black Hole
A black hole with spin 0.215, seen from just above its accretion disc.
Simulation I · General relativity
I

The Black Hole

A star's worth of mass, folded so tightly that not even light escapes.

Gargantua, the black hole in Interstellar, is a spinning black hole. Mass curves spacetime, and light, which always takes the straightest path available, follows the curve. Close to the hole the bending is so strong that light can orbit it, loop around behind it, or fall in for good.

Every pixel here is a ray of light traced backwards from the camera through the curved spacetime around the hole. If the ray crosses the event horizon, the pixel is black: that is the shadow. If it crosses the thin disc of hot gas orbiting the hole, it picks up the disc's glow, shifted in colour and brightness by the speed of the gas and by gravity itself.

Open the simulation
What you are seeing
The shadow
Every direction from which no light can reach you. It is about two and a half times wider than the event horizon, because light passing close to the hole is captured too.
The arch over the top
The far side of the disc, behind the hole. Its light is bent up and over the shadow, so the disc seems to wrap around it.
The thin ring
Light that skimmed the photon sphere and looped around the hole before escaping. Each extra lap makes a thinner, fainter image.
One side brighter
Gas on one side races towards you at a sizeable fraction of the speed of light. Relativistic beaming throws its light forward, so the approaching side outshines the receding one.
The physics
Light follows null geodesics
ds² = gμν dxμ dxν = 0
The spacetime interval along a light ray is zero; the metric g describes the curvature.
Event horizon
r₊ = M + √(M² − a²)
a is the spin per unit mass. At a = M the hole spins as fast as it possibly can.
Disc brightness
Iobs = g³ · Iemit , g = νobs / νemit
Iν/ν³ is conserved along a ray, so the redshift g sets both colour and brightness.
Into the Black Hole
Just inside the horizon. The black region below is still only part of the sky, ringed by blueshifted light.
Simulation II · General relativity
II

Into the Black Hole

What you would really see on a one-way trip through the event horizon.

What would you see if you fell into a black hole? Space flows inwards around a black hole like a river, faster the closer it gets, and at the horizon it flows at the speed of light. Dropped from far away, you are carried along with it, so you cross the horizon without feeling a thing. Nothing marks the boundary. Only afterwards does every path lead to the singularity.

Here the camera falls straight into a non-spinning black hole. Because the hole is perfectly round, a light ray's path depends only on your distance and the angle you look at, so every possible ray is traced once into a table. Your fall also changes the colours you see: light from below is blueshifted and light from above redshifted, by an amount that combines gravity and your own speed.

Open the simulation
What you are seeing
The black region below
Every direction from which no light can reach you. It grows as you fall, yet as you cross the horizon it covers only a circle about 84° across. The horizon always seems to lie ahead.
The ring at its edge
Light that skimmed the photon sphere, at one and a half times the horizon radius. You are falling towards it, so it is blueshifted to a blue-white glow.
Inside
The singularity is no longer a place below you but a moment in your future. Dropped from far away, you reach it 4GM/3c³ of your own time after crossing the horizon: about 28 seconds for Sagittarius A*.
The last view
Near the singularity, the sky above dims to a deep red while light from the sides is squeezed into a thin, intensely blue band around you.
Hovering instead
Someone hovering just outside the horizon on a powerful rocket sees something else entirely: the whole outside universe squeezed into a small, brilliantly blueshifted circle overhead.
The physics
The river of space
v = √(2GM / r)
The speed at which space flows inwards, and the speed of anything dropped from far away. It reaches c at the horizon, r = 2GM/c², and exceeds it inside.
Colour of the sky
D = 1 / (1 + (v/c) cos α)
α is measured from straight up. The factor combines gravity and your own fall exactly: blue below, red above.
Time left
τ = (2/3) · r^(3/2) / √(2GM)
Your own time to the singularity. From the horizon: 4GM/3c³, about 28 s for Sagittarius A* and 12 hours for M87*.
The Wormhole
Approaching the mouth: the far galaxy inside, our own sky wrapped into rings around it.
Simulation III · General relativity
III

The Wormhole

A tunnel through spacetime, seen as a crystal ball onto another galaxy.

A wormhole connects two distant regions of space through a shortcut. The one in Interstellar, designed with physicist Kip Thorne, is a smooth, spherically symmetric tunnel described by three numbers: the radius of its throat ρ, the length of the throat 2a, and a lensing width set by M.

From outside it looks like a sphere. Light that passes through the tunnel brings the view from the other side, so another galaxy appears inside it, while light skimming the mouth is wrapped into rings of the sky behind you. Because the shape is so symmetric, a light ray's fate depends on only two numbers, so every possible ray is integrated once into a table and the camera can fly straight through.

Open the simulation
What you are seeing
The sphere
The mouth of the wormhole. Inside it you see the sky of the far side, lensed through the throat.
The rings around it
Light from your own sky, bent around the mouth. The nearer the edge, the more times it has been wrapped.
Inside the throat
The walls are both skies, stretched along the tunnel. The camera turns to face them as it passes through.
Looking back
From the far side, your home galaxy appears inside the sphere instead.
The physics
The geometry
ds² = −dt² + dℓ² + r(ℓ)² dΩ²
ℓ is the distance travelled through the tunnel; r(ℓ) is the size of the sphere at that point.
The shape
r(ℓ) = ρ + M [ x·arctan x − ½ ln(1 + x²) ]
with x = 2(|ℓ| − a) / πM outside the throat, and r = ρ inside it.
Which rays pass through
b = r · sin α < ρ
The impact parameter b is conserved along a ray; only rays with b smaller than the throat get through.
Near Light Speed
At 0.99c the whole galaxy is squeezed forward into a narrow, blue-shifted band.
Simulation IV · Special relativity
IV

Near Light Speed

Fly towards the centre of the Milky Way and watch the sky crowd in ahead of you.

Nothing with mass can reach the speed of light, but it can get as close as you like. As it does, the sky changes in three ways at once. Aberration squeezes the view forwards, the way rain seems to slant towards you when you run. The Doppler effect shifts the light ahead to bluer colours and the light behind to redder ones. And beaming makes the view ahead brighter and the view behind darker.

Speed here is set by the rapidity η, where your speed is v = c·tanh η. Rapidities simply add, so equal steps of the slider feel like equal pushes of the engine, even as v creeps ever closer to c. Ship time and galaxy time are counted separately: at high speed, years pass at home for every second on board.

Open the simulation
What you are seeing
The bright cone ahead
Starlight from all around is crowded forwards. At 0.99c, everything that was ahead of you fits into a circle only 16° across.
Colour shift
Stars ahead are blue-shifted and stars behind are red-shifted, by the Doppler factor D.
Darkness behind
Beaming dims the view behind you so strongly that at high speed the sky there almost vanishes.
Passing stars
A 3D field of nearby stars streams past with real parallax, stretched by the same aberration.
The physics
Speed from rapidity
β = v/c = tanh η , γ = cosh η
Rapidities add like ordinary numbers; speeds do not.
Aberration
tan(θship / 2) = e−η · tan(θgalaxy / 2)
Angles from the direction of travel shrink as η grows.
Doppler factor
D = γ (1 + β cos θgalaxy)
A star at temperature T looks exactly like a star at D·T: blackbody light stays blackbody.
Glossary

A few words

Schwarzschild radius
The size to which a mass must be squeezed to become a black hole: rₛ = 2GM/c², about 3 km per Sun of mass.
Event horizon
The boundary of a black hole. Anything inside, light included, can never get out.
Singularity
Where general relativity predicts infinite density at the centre of a black hole. It most likely marks where the theory breaks down, not a real infinity.
Photon sphere
The radius at which light can orbit a black hole in a circle. It is unstable: a nudge sends the light in or out.
Shadow
The dark patch a black hole casts on the sky: every direction from which no light reaches you. About 2.6 times as wide as the horizon.
Accretion disc
A flat disc of gas spiralling into a black hole, heated by friction until it glows.
ISCO
The innermost stable circular orbit: the closest gas can orbit before plunging in. Spin moves it inwards for gas orbiting with the spin.
Frame dragging
A spinning mass drags spacetime around with it, so nothing near a spinning black hole can stay still.
Ergosphere
The region just outside a spinning black hole's horizon where frame dragging is so strong that nothing can stay still.
Spaghettification
The stretching of a falling object by tides: gravity pulls its near end harder than its far end.
Hawking radiation
The faint thermal glow that quantum effects should give every black hole, letting it slowly evaporate.
Gravitational lensing
The bending of light by mass. It magnifies, distorts and duplicates whatever lies behind.
Gravitational redshift
Light climbing out of a gravitational well loses energy and shifts to redder colours.
Relativistic beaming
A source moving towards you looks brighter, and one moving away looks dimmer, far beyond the everyday Doppler effect.
Free fall
Moving under gravity alone, with no rocket or ground pushing back. A falling observer feels weightless, and crosses a black hole's horizon without noticing it.
Einstein–Rosen bridge
In the idealised, eternal black hole, a tunnel to a second universe. It pinches off too quickly for anything to cross, and real black holes, formed by collapsing stars, do not have one.
Throat
The narrowest part of a wormhole, where its spheres have their smallest radius ρ.
Rapidity
A measure of speed that adds simply: two boosts of η₁ and η₂ make η₁ + η₂, while the speed tanh η never reaches c.
Aberration
The change in the apparent direction of light caused by your own motion.