How it works

How it works

You carry a light through a flat room of sculptures, neon tubes and paper cut-outs, and every frame the page solves how that light travels in the plane. Shadows are sharp where a shape touches the floor and widen with distance. Light pools inside the broken ring and beams out of its gap. Lit faces throw their colour onto the floor. This is radiance cascades, the 2D global-illumination method behind Vercel’s home-page hero. The idea that makes it real-time: close to a point you need fine positions but few directions, and far away you need many directions but coarse positions. So the work is split into cascades that trade one for the other (4× the rays and 2× the probe spacing per level), and every cascade costs the same.

Pipeline

Numbers for the default (1280 × 720 CSS at 2× = 2560 × 1440 canvas, render scale 0.5, Auto = 5 cascades,
4 base rays, base interval 1.5). One "unit" = one cascade-0 probe spacing = 4 CSS px.

ONCE PER SCENE OR RESIZE
  Canvas2D   shapes and glyphs at full resolution ──▶ occ  RGBA8 2560×1440 + mips  albedo, coverage
                                                  ──▶ emi  RGBA8 2560×1440 + mips  emission, coverage
  seed       AA edge texels → 50% crossing of the full-res coverage, found by a quarter-texel walk
             along its gradient ─────────────────────────▶ RG32F 1280×720
  jump flood 11 passes (step 1024 … 1) + 1 extra, 9 taps ───▶ RG32F 1280×720  nearest edge point
  distance   signed, in units (negative inside) ─────────────▶ sdf  R16F 1280×720 (linear)
  collision  distance to the occluders only (Neon re-floods without its tubes), a cell per 6 CSS px
             ─▶ RGBA32F 214×120 ─▶ float readPixels once ─▶ CPU grid for the lights
  visibility one pass per cascade, 3 outputs: each of a texel's 12 rays (1 in the top cascade) marched
  cache      through the sdf as the old per-frame march did, minus the lights ─▶ where it first enters
             a shape ─▶ 3 × RGBA16F 640×384 per cascade, 26 MB with the mask.  Neon: where it enters its first
             tube and what stops it (16-bit fractions of the ray + 1 bit: tube or block) ─▶ RGBA32UI, 52 MB
             + cascades 0, 1: which of the 16 corners the merge drops (buried) ─▶ R16UI 640×384
             (also rebuilt when the cascade layout or the base interval changes)

EVERY FRAME (JS ≈ 0.2 ms)
  CPU        pointer ─▶ target pushed clear of the occluders ─▶ damped spring (0.8–8 Hz, ζ 0.9,
             240 Hz substeps) that collides with them ─▶ light disc
             + 0–3 accent discs on slow orbits, same spring and collisions ─▶ uniforms only
             (lights never enter the SDF) ▸ budget guard (every 2 s)

  cascades   one RGBA16F 640×384 ping-pong pair, direction-first: tile = direction, texel = probe
   i  probes    rays/probe  interval (units)  steps* merge with i+1
   4  20 × 12   1024        127.5 – 511.5      64    none: escaped rays take the sky
   3  40 × 24    256         31.5 – 127.5      64    bilinear fix: 4 child rays × 3 upper probes
   2  80 × 48     64          7.5 –  31.5      32    bilinear fix
   1  160 × 96    16          1.5 –   7.5      32    bilinear fix, buried upper probes left out
   0  320 × 192    4          0   –   1.5      32    bilinear fix, buried upper probes left out
             (the 4th, 1/16-weight upper probe takes the more occluded of its two neighbours' rays)
             * sphere-tracing budget, spent once per scene by the visibility cache
             per texel: cull the lights its rays can reach (its direction's sector, bent ≤ 1.06 upper
             spacings); read its rays' first shapes ▸ a child direction whose 3 rays meet nothing (no
             shape, no light in reach, no dropped corner) = bilinear blend of its 4 upper probes,
             one filtered fetch ▸ otherwise per ray: light discs solved exactly (the cursor light stops
             it, an accent adds and lets it pass); reaches its shape → albedo (occ mip 2) × last frame's
             irradiance (bounce); Neon: the first tube adds its glow (emi mip 2) and passes half the
             light, a second tube or a block stops it
             occluder opacity < 1: rays cross any number of shapes, so every ray sphere-traces sdf ∪
             light discs every frame (up to 20 more steps on −sdf per budgeted step to find each exit)

  irradiance mean of cascade 0's 4 rays × "probe is outside" weight ─▶ E  RGBA16F 320×192
             (ping-pong: this frame's E is next frame's bounce source)

  composite  canvas 2560×1440, without the lights' near field and discs (exactly 0 beyond 4R + 2),
             then the full composite again, scissored to a box of 4R + 2 round each light
             floor albedo · (E + exact share of each light within 4 radii)  (+ page colour, dark themes)
             shapes: crisp coverage ▸ rim = E 2.25 units outside the nearest edge × bevel profile
                     ▸ top face lit by the hovering lights ▸ glass tint below full opacity
             emitters (hot core) ▸ light discs (dark: hue at the rim, white core; light: floor + light,
             soft glow) ▸ filmic shoulder ▸ sRGB ▸ static TPDF dither

The ideas that matter

Parameters

Presets

Performance & compatibility

References & credits