Feature Library

Northern lights

3.16 GPU · 0.12 CPU ms
A still of the Northern lights demo
Still
The live demo starts when it’s in view.Drag or use the arrow keys to look around · space for a substorm

An aurora worked out as physics on WebGPU, seen from a frozen fjord.

What it costs a frame

3.16 ms
0.12 ms
GPU
3.16 ms
CPU, median
0.12 ms
CPU, 95th pct
0.20 ms
Draw calls
0
Weight
Heavy

Measured 11 November 2026 on 13th Gen Intel(R) Core(TM) i9-13900H, Chrome 157, 1920×1080 at 1×. 600 frames × 3 rounds, median kept. What ran: Looking round the sky with a substorm every 20 s: the sheets’ Biot–Savart step, 65,536 electrons and the light they leave, the oval, the aurora marched at about 0.45 MP and the fjord traced at the full stage, timed with its own timestamp queries. Phones: tiers are being measured next.

On every machine it was measured on
MachineGPU msCPU msCPU p95
unknown GPU · 13th Gen Intel(R) Core(TM) i9-13900Hreference · measuring tool3.160.120.20
apple · Apple A19 Proin a browser tab · 16 November 202614.70.300.42
Intel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258Vin a browser tab · 15 November 202618.40.210.42

Bars against one 16.7 ms frame. A browser-tab run is timed in a visible tab without the tool’s scripted input, so read it as close, not exact.

What it needs

Renders with
WebGPUNeeds WebGPU: current Chrome and Edge, Safari 26+, Firefox 141+ on Windows.
Your browser
Checking…Looking for WebGPU
Depends on
NothingNo other packages

What it’s for

  1. Night-sky backdrops and hero sections
  2. Splash and loading screens
  3. Winter and polar scenes in games
  4. Ambient screens and screensavers
  5. Science and planetarium visuals

Pitfalls, in brief

  1. Reflections read off the screen’s own pass show a hard edge where the reflected ray leaves the screen, and it moves with the view.
  2. A heightfield traced by sphere steps runs out of steps on rays grazing a long slope a few metres over it: they fell through to the sky or the ice, in bands and speckle.
  3. Rays near the horizon skim the flat ice 15 to 100 m over it, where sphere steps are a few tens of metres: they spent the whole budget in the first few km and fell through to the sky, a stepped dark wedge under the far mountains at the fjord’s end.
  4. Detail finer than a pixel (spruce crowns, snow crystals, stars bent by the ice’s ripples) twinkles as single pixels from frame to frame: fade each by the pixel’s footprint on the ground, as the near crystals already were.
  5. On a weaker GPU (harness tier medium or low, tier option) it draws at low quality: a third of the electrons, the aurora marched at about 0.25 MP and fewer steps over the fjord.
9 more in brief
  1. On a phone (tier low) size the drawing with auroraDrawSize: about 1 MP at most, stretched by the canvas.
  2. Call frame(dt) every animation frame even when nothing moves: it draws only when something changed (speed 0 and a still camera draw nothing at all).
  3. Never queue more than one frame ahead: frame() skips while the last is still on the GPU, and the sheets catch up at most eight steps next time (a slow frame lets the rest go rather than stalling).
  4. Its size is the drawing’s in device pixels: call resize() with CSS size × devicePixelRatio.
  5. The first frame after creating it (or a quality change) runs the sheets for five seconds of their own and rebuilds the light: about a frame’s hitch, by design, so the curtains have folded when they first show.
  6. The light is accumulated over time (green lives 0.7 s, red 4 s): a change of strength fades in rather than jumping.
  7. The aurora is soft: it is marched at about half a megapixel and stretched.
  8. Drawing into your own texture: create with canvas null and your format, then step(dt) and encode(encoder, view); your view must be the size given to resize().
  9. Without WebGPU createAurora returns null: drawAuroraStill paints a 2D still of the same scene.
14 pitfalls in full, the hook-up guide, the module source and its tests come with the part.

Where it comes from

From SpaciousPro. Fully custom code.

Robert Krasny, desingularised vortex sheet roll-up (1986): The sheets’ regularised Biot–Savart sum (a blob of radius δ in place of each point vortex’s core) is his method.

T. J. Hallinan & T. N. Davis, small-scale auroral arc distortions (1970): Curls and folds in auroral arcs as a Kelvin–Helmholtz-like roll-up of a sheet of current: the idea the sheets follow.

M. H. Rees, auroral excitation by energetic electrons (1963): The deposition height against electron energy (about 150 km at 1 keV, 110 at 10) is a fitted line after his curves.

Mark Jarzynski & Marc Olano, Hash Functions for GPU Rendering (2020): The PCG hash under every random number and noise, in the shaders and on the CPU.

Jorge Jimenez, interleaved gradient noise (2014): The march’s per-pixel start offset, which keeps its steps from banding.

Krzysztof Narkowicz, ACES filmic tone mapping curve (2015): The tonemap is his fit, kept as published.

Fritz Kasten, relative optical air mass (1965): The extinction near the horizon uses his air-mass formula.

Steven Worley, cellular texture basis (1996): The ice’s cracks are the distance between the nearest two cells (F2 − F1).

F. Kenton Musgrave, ridged multifractal terrain: The mountains’ ridged, weighted octaves follow his ridged multifractal.

auroravortex sheetsbiot–savartkelvin–helmholtzray marchingcomputewgslraw webgpunight skyemission lines

Near it in the frame