Plain WebGL2 · one twisted mesh

Every strand
catches the light.

A folding sheet of hair-fine filaments, coloured by an authored palette and glowing where it turns edge-on. Move near it and it leans away, sending a slow wave down its length.

How it’s built
How it works

How it works

One sheet of silk, twisted along its length and rolled edge-on in travelling folds. It is a single 49,000-triangle mesh whose shape is computed entirely in the vertex shader. Its colour comes from an authored palette ramp. Its texture is a few hundred iso-lines of the across-coordinate, each held to a constant pixel width by its own screen-space derivative. Its light comes from the facing ratio: where the sheet turns edge-on, the filaments crowd together and the fold glows. The cursor is a soft obstacle. The ribbon leans away from it, and crossing it rolls the sheet into a glowing fold that travels down its length and eases out over about three seconds.

Pipeline (per frame)

CPU  (~0.1 ms of JS)
  pointer ──▶ critically damped spring (ω = 9 rad/s, about 0.2 s of lag)
  centre curve, mirrored from the vertex shader ──▶ 128 cells projected to the screen
  forces   push away from the cursor (−tanh of the signed distance across, Gaussian falloffs)
           + drag and twist in proportion to the cursor's speed across the ribbon
             (the twist footprint is 1.8× wider along the ribbon than the push)
  wake     two damped wave equations along the ribbon, bend and twist:
           q'' = c²·q_xx − ω²·q − 2γ·q' + F     c = 1.15 units/s
           bend ω = 2.1 rad/s, γ = 1.25 /s · twist ω = 1.1 rad/s, γ = 0.7 /s
           integrated in substeps of ≤ 1/240 s together with the spring
           ──▶ texSubImage2D  uWake  RG16F  128 × 1
  ambient  φ advances at speed × (1 − 0.3·hush); a crossing sets hush → 1, which decays in ~1.5 s
           k·φ mod 2π for the 8 phase terms, in double precision ──▶ uPhA, uPhB (vec4)

GPU  (2560 × 1440 backing store)
  [shadow]     light presets only
               same mesh; the VS slides every vertex along the light onto a backdrop plane;
               coverage fades with height above it; MAX blend ──▶ SH  RGBA8  640 × 360
               2 × (horizontal + vertical) 9-tap Gaussian ──▶ SH
  [ribbon]     385 × 65 grid = 49,152 triangles, one drawElements, depth-tested, double-sided
               VS  surf(u, v) = centre(X) + across(θ)·v·width + billow·normal(θ)
                   θ = twist·πX/3.6 + fold·sin(1.25X − 0.9φ + …) + wake.twist(X)
                   wake read with a 2-tap cubic B-spline; normal = cross of two finite differences
               FS  palette(X/3.4 + drift) ▸ wrap diffuse ▸ Kajiya-Kay sheen ▸ fold glow (1 − |N·V|)³
                   ▸ filaments: f = v·N, N = min(count, ribbon width in device px / 4.2),
                     coverage = 1 px box ∩ W px line, measured with |∇f|,
                     fading to the pattern's mean once the period drops under 3.6 px
               ──▶ MS  2560 × 1440, 2× MSAA at DPR ≥ 1.5 (4× at DPR 1) + DEPTH16
                       RGBA16F on dark pages, SRGB8_ALPHA8 on light ones
                       premultiplied: cleared to 0, alpha = coverage
  [resolve]    blitFramebuffer ──▶ scene  same format  2560 × 1440
  [depth blur] 13-tap downsample × 4 ──▶ D1 … D4  RGBA16F  1280 × 720 … 160 × 90
  [bloom]      dark presets only
               soft-threshold 13-tap from D1 ──▶ B  RGBA16F  640 × 360 … 80 × 45
               3 × tent upsample, additive ──▶ B 640 × 360
  [composite]  ──▶ canvas  2560 × 1440
               blur level = 4 · blur · band(distance along the projected ribbon axis)
               ▸ bicubic blend of the two nearest D levels
               ▸ + backdrop (page, shadow, vignette) × (1 − coverage) ▸ + bloom
               ▸ hue-preserving shoulder (dark) ▸ sRGB encode
               ▸ calm zone behind the HUD title and eyebrow (dark) ▸ TPDF dither

The ideas that matter

Parameters

Presets

Performance & compatibility

References & credits