How it works

How it works

The picture on this page is wet paint. Drag through it and a small, viscous, incompressible flow carries the paint along, curling it into eddies behind the brush and stretching it into glossy ribbons. After about three seconds it relaxes back to exactly the picture it was. What gets moved is not the image but a field of offsets D: the paint shown at x is the untouched picture read at x + D(x). Only that smooth warp field is ever advected and resampled. The picture is read fresh from a pristine texture every frame, so the type, the brush bristles and the film grain stay razor-sharp however long you swirl them.

Pipeline (per frame)

pointer segment (shell)    at 1280×720 @2×: canvas 2560×1440 · flow 228×128 · smear 910×512
 │
 ├─▶ SPLAT          vel   RG16F 228×128    capsule a→b: v ← mix(v, v_pointer, w·grip)  (while moving)
 ├─▶ CURL           curl  R16F             ω = ∂v_y/∂x − ∂v_x/∂y
 ├─▶ VORTICITY      v0    RG16F            v += swirl·ω·(N_y, −N_x)·dt,   N = ∇|ω| / |∇|ω||
 ├─▶ VISCOSITY ×n   vel   RG16F            Jacobi on (I − ν·dt·∇²) v = v0,  n = ⌈4 + 4·log2(1 + α)⌉ ≤ 24  (10 here)
 ├─▶ DIVERGENCE     div   R16F             solid walls at the frame
 ├─▶ PRESSURE ×20   p     R16F ping-pong   warm start from 0.8 × last frame
 ├─▶ GRADIENT       vel                    v −= ∇p   → divergence-free: swirls, no bulges
 ├─▶ ADVECT         vel                    semi-Lagrangian, × e^(−dt / momentum)
 │
 ├─▶ D FORWARD      tmp   RG16F 910×512    D̂ = D(x − u·dt) − u·dt,  u = strength·v  (uv units, v read as a B-spline)
 ├─▶ D CORRECT      D     RG16F 910×512    MacCormack: D̂ + ½(D − D̃), clamped to the 4 source texels
 │                                         × e^(−dt·(1/τ + 3·(|D|/reach)⁴)),  hard cap 1.4·reach
 ├─▶ H BLUR x, y    tmp → hb  R16F         wet height h = smoothstep(|D| / 0.3·reach), binomial σ ≈ 2 texels
 ├─▶ FIELD          F     RGBA16F 910×512  (D, ∇h),  ∇h = Sobel of the blurred h at ±1.5 texels
 └─▶ COMPOSITE      canvas 2560×1440, opaque
                    F through a cubic B-spline (4 bilinear taps)  →  uv' = uv + D
                    picture: textureGrad(uv', ∂uv'/∂x, ∂uv'/∂y), trilinear + 8× anisotropic
                    split:   along 0.085·D + 0.014·v; 1 tap < 0.4 px, R/G/B < 4 px, else 5 spectral
                    relief:  picture alpha one pixel right and up through the warp (impasto, ink)
                    wet:     darker, +22% saturation · Lambert relief · cast shadow (1 tap toward light)
                    sheen:   key light as a disc in slope space + broad lobe, × wet
                             (on dark pages the lobe only lights paint with colour, tinted by it)
                    highlight shoulder → sRGB → ±1 LSB triangular dither
 41 draws per frame (42 while the pointer moves)

 PICTURE  baked on load, resize and content change (12–53 ms once, measured)
   oil painting   GUIDE 640×360 RGBA16F (underpainting + stroke angle) → PAINT: 4 stroke layers
   photograph     PHOTO shader (dunes, sun, haze, grain)
   editorial, poster   Canvas2D → RGBA8 → FINISH (paper fibre / grain, height from ink or luminance)
   → SRGB8_ALPHA8 2560×1440 + mipmaps, MIRRORED_REPEAT; alpha holds the picture's height

The ideas that matter

Parameters

Presets

Performance & compatibility

References & credits