Demo hero, drawn under the fluid

Make every pixel feel poured.

A mock landing page for testing the trail. The liquid is a WebGL layer on top of all of this, yet it never takes a click and always clears a window around your cursor.

Try clicking a button through the liquid.

How it works

How it works

A real Navier–Stokes simulation runs on a 228×128 velocity grid. A 1820×1024 dye field rides on it and is drawn as a thick liquid over the page. The trick is that your pointer is not a paintbrush. It only partly grips the fluid, so the dye is left behind and keeps flowing as a wake, while a clear window around the pointer keeps whatever you are about to click visible.

Pipeline (per frame)

pointer segment: last sim step → this one     fixed 60 Hz step (0–2 per frame)
 │
 ├─▶ SPLAT vel    vel   RG16F  228×128     mix(v, v_pointer, 1−(1−w·grip)^(Δt·60)); w = capsule Gaussian
 ├─▶ SPLAT dye    dye   R16F  1820×1024    d += w · min(1, density·travel/σ) · ½(1 + depth·sin(q·2π/λ))
 │                                         q = signed distance across the stroke; the direction turns
 │                                         from the last capsule's to this one's (≤ 0.6 rad per capsule)
 │                                         depth = .7, → 0 at the brush rim, on sharp turns and in
 │                                         the leading cap, so stroke fronts get no stripe teeth
 ├─▶ CURL         curl  R16F   228×128     ω = ∂v/∂x − ∂u/∂y
 ├─▶ VORTICITY    vel                      v += ε·(N × ω)·Δt,  N = ∇|ω| / |∇|ω||       Fedkiw 2001
 ├─▶ COPY         v₀    RG16F  228×128     park v₀ for the implicit solve
 ├─▶ VISCOUS ×12  vel                      Jacobi on (I − ν·Δt·∇²) v = v₀              Stam 1999
 ├─▶ DIVERGENCE   div   R16F   228×128     ∇·v; edges: solid (mirror v) or open (copy v)
 ├─▶ KEEP         pres  R16F   228×128     p ← 0.8·p   (warm start)
 ├─▶ PRESSURE ×20 pres                     Jacobi on ∇²p = ∇·v   (open edges: p = 0 outside)
 ├─▶ GRADIENT     vel                      v ← v − ∇p
 ├─▶ ADVECT vel   vel                      semi-Lagrangian self-advection, ÷(1 + 0.55·Δt)
 └─▶ ADVECT dye   dye                      semi-Lagrangian, ÷(1 + fade·Δt); open edges: 0 when the
                                           backtrace leaves the screen (no edge streaks flow in)
                                           [MacCormack: forward → hat R16F 1820×1024, then
                                            corrected + clamped to the 4 source texels]
 ┌──────────────────────────────── display, every frame ───────────────────────────────┐
 │ SOFT  ¼-res → 2× (H+V) 9-tap Gaussian                              RG16F 455×256    │
 │         .r bright-pass (halo) · .g coverage (glossy) or thickness (luminous)        │
 │ DISPLAY → canvas 2560×1440 RGBA8, premultiplied                                     │
 │   glossy:   h = smoothstep(0,1.6,min(d,.8)) + .94·ln(1+max(d−.8,0)) → normals       │
 │             → Blinn-Phong · ramp(thin→mid→deep), over a cast shadow: SOFT.g         │
 │             sampled toward the light, tinted from the deep colour                   │
 │   luminous: ramp emitted · Hessian crest strands · tube normal = fine √d slope      │
 │             (fades out on thick cores) + slope of SOFT.g (ribbon scale) → rim +     │
 │             2-light specular · hue-preserving shoulder, + halo from SOFT.r          │
 │             α = max(.18·a, max(rgb)): dim body is see-through glow                  │
 │   both:     a = smoothstep(cut, cut+soft, d) · clear zone (real pointer only)       │
 │             · idle fade, ±1 LSB dither                                              │
 └─────────────────────────────────────────────────────────────────────────────────────┘
 43 draws per moving frame: +1 with MacCormack, +5 for SOFT (luminous, or a visible shadow)

The ideas that matter

Parameters

Presets

Performance & compatibility

References & credits