Plain WebGL2 · one instanced draw per pass

Light, bent
into shape.

Tapered tubes chase your cursor in follow-the-leader chains, lit by four point lights and bloomed on dark.

How it’s built
How it works

How it works

Sixteen tapered chrome tubes chase the cursor like a bundle of cables. Each tube is a chain of points in which every point lags the one ahead of it, so a tube’s shape is literally the pointer’s recent path, crisp at the head and progressively smoothed toward the tail. There are no tube meshes: one instanced draw per pass (the scene, plus the cast shadow on the light presets) extrudes camera-facing ribbons from a spline in the vertex shader, and the fragment shader rebuilds the round cross-section analytically and lights it like polished metal.

Pipeline (per frame)

CPU  (~0.13 ms of JS, 0.2 ms p95)
  pointer │ intro ghost │ idle figure-eight ──▶ one blended target
  chains   16 tubes × 64 points: dp/dt = k·(lead − p), swept head → tail
           in substeps of ≤ 1/240 s (4 per frame at 60 Hz), target lerped across the frame
  pack     sort tubes far → near ▸ drop points < 0.6 px apart ▸ arc length, radius
           ▸ spline curvature per point ─▶ corners (2 passes; none under 2–3.5 px of radius
             or in the last 10–16% of the tail) ▸ runs of corners within 0.9 radii merge
           ▸ sample measure, 6 per chain point (at most 1024 per tube):
             arc (1 per 5 px) + bends (angle × √radius) + round joins (integer runs)
           ▸ per segment: the fold it leads into, if within 2.5 radii (for the mitre)
           ──▶ texSubImage2D  uPts  RGBA32F  (64 + 1) × (2 × 16) texels = 33 KB

GPU
  [shadow]     light presets only
               same instanced strips, widened by the blur width, offset by height,
               MAX blend ─────────────────────────────▶ shade  RGBA8    640 × 360  (¼)
  [tubes]      drawArraysInstanced(TRIANGLE_STRIP, 2 × 384 vertices, 16 instances), no attributes
               VS: binary-search the measure ▸ centripetal Catmull-Rom ▸ ribbon ⟂ tangent and view
                   (or, inside a join, a fan sweeping the outer side around the corner point)
                   radius sin(πt)^taper ▸ inner side squeezed to the bend radius ▸ +1 px AA skirt
               FS: offset q across the ribbon ▸ mitre cut on a fold's head-side arm
                   ▸ normal q + √(1−|q|²)·view (cylinder or cap sphere) ▸ GGX × 4 point lights
                   ▸ strip-light studio env (split-sum fit) ▸ emissive core ▸ depth fade
               premultiplied “over”, painter’s order ─▶ scene  RGBA16F  2560 × 1440
  [bloom]      dark presets only (skipped when strength = 0)
               prefilter: 5-tap dual filter, Karis weights, soft knee ─▶ L0  RGBA16F  1280 × 720
               down × 5 (dual filter)  ─▶  640 × 360 … 40 × 22
               up × 5 (tent, blend radius·src + dst) ─▶ L0
  [composite]  ─▶ canvas  2560 × 1440
               backdrop + glow + vignette ▸ × shadow ▸ ACES(unpremultiplied tube × exposure)
               ▸ screen(ACES(bloom)) ▸ TPDF dither

The ideas that matter

Parameters

Presets

Performance & compatibility

References & credits