How it works
A quarter of a million GPU particles, each one texel of a floating-point texture, spring toward points sampled from a word drawn on a hidden 2D canvas. They hold it, let go in a sweep from left to right, ride a divergence-free curl-noise current as silk, and get called back by the next shape. Run your cursor through the letters and a small invisible fluid carries its wake. Each particle's spring lets go where that wake is moving and stays off for a while wherever the stroke cut through its letter. The letters part like water and heal behind you over about three seconds, instead of snapping back like rubber. Three quieter tricks make it look expensive. Particles are matched by rank, so every morph flows locally rather than criss-crossing the screen. Each particle is drawn as a Gaussian streak over exactly the distance it moved that frame, graded by the trail's own fade, so motion is continuous rather than stamped dots. Each streak is also sized by how sparse the sheet around it was a frame ago, so a stretched sheet stays a film instead of breaking into hairs and dots.
Pipeline (per frame)
JS effect clock → shape k + phase · pointer segment → wake splat + bow capsule
bow presence (decays 0.6 s) · view fit: targets scaled + offset into the stage an open
panel leaves free (eased 0.18 s)
│
WAKE hidden stable fluid 228×128 RGBA16F (short side 128): xy velocity, z disturbance.
No vorticity confinement. Sleeps max(heal, 7.1 s) + 0.5 s after the last stroke,
fading out over that last 0.5 s
splat+div grip capsule: mix(v, v_pointer, w·grip), never add · z = max(z, w) (a plain
copy when the pointer is still); ½ central differences of the result, second
target of the same pass ──▶ vel, div
pressure 10 Jacobi iterations, warm start ×0.8, folded into one 302-tap stencil
(taps mirrored at the border, the same as clamp-to-edge Jacobi) ⇄ p
grad+advect v −= ½·∇p wherever the advection samples · semi-Lagrangian self-advection,
fade 0.7 /s · z −= dt/heal, in place ──▶ vel
PARTICLES state 512×512 RGBA32F = 262,144 × (x, y, vx, vy) in screen heights · NEAREST + texelFetch
update f = formation envelope of (t − delay·0.8 s): ramp in 0.75 s, hold, let go over 0.5 s
u = curl-noise current (2 octaves, analytic) · wake velocity sampled at the particle
wake = max(|u_wake| / 0.5 sh/s, smoothstep(0, ½, z at the particle's home))
k = f · (1 − clamp(k_wake·wake) · tether(|T − p|)) · (1 − bow) ← the Igloo trick
a = ω²·k·(T − p) + drag·(u_curl + u_wake) + bow push along the stroke's normal
v' = (v + dt·a) / (1 + dt·(2ζω·k + drag)) implicit damping + drag ──▶ state
targets one 512×512 RGBA32F per shape (x, y, sweep delay), read-only
RENDER HDR atlas 1932×1822 RGBA16F: full-res region 1932×1087 (canvas 2560×1440 capped at
2.1 MP), a 192 px guard band, half-res region 966×543
fade dst ·= 0.01^(dt/trail) blend (ZERO, SRC_ALPHA) ──▶ HDR
streaks 262,144 instanced quads, no attributes (state fetched by gl_InstanceID)
Gaussian capsule over this frame's travel, graded 1 → fade from head to tail;
σ × defocus(distance from home) × √(0.35 / ρ_last frame), ≤ 3×;
σ across × (1 + 2·ramp(speed)); energy-conserving, blend (ONE, ONE)
out: local coords in σ√2 units + 3 flat half-packed words (first-vertex rule)
wide ones (σ ≥ 1.6 px, σ across ≥ 3 px) → half-res region, σ² − 0.5 px², × 0.95
quads wholly off screen dropped (same draw, same pass) ──▶ HDR
bloom 5 box downs 966×543 … 60×33 (the first sums both regions), 4 tent ups added
back in place, except the 483×271 one, written beside its level: that level's
alpha is next frame's ρ ──▶ 966×543
composite full-res + half-res region, each bilinear and clamped to its own edge
dark: 1 − e^(−k·rgb) per channel, screened with bloom
light: Beer-Lambert ink over paper + the pyramid cast down-right as a soft shadow
+ interleaved-gradient-noise dither, premultiplied ──▶ canvas
ON CHANGE (CPU, once per word set / resize / count: 100–180 ms at 262k for three shapes, ~320 ms at 1M)
canvas 2D text or glyph (≤ 1600 px; portrait words up to 1.6× taller) → full-cell
jittered lattice inside the 0.5 alpha contour → exactly N samples, order kept
→ 64 x-quantile strips, rows sorted → RGBA32F upload
render passes per frame: 3 wake (0 once idle) + update + fade and streaks (one pass)
+ 5 bloom downs (2 with bloom off) + 4 ups + composite = 15 (12 idle, 8 bloom off)
The ideas that matter
- Don't let the spring fight the wake, and let the cut stay open. A plain spring-to-target swarm snaps back mid-stroke, and the cursor feels like it is dragging rubber. Here a 128-cell stable-fluids grid takes the cursor as a grip splat, and each particle drags toward that fluid's velocity. Its spring is scaled by
1 − k·|wake|, which is what Igloo Inc and Emotion Agency do with their particle scenes. Fluid speed alone heals in under a second, and slowing the fluid's decay only keeps it pushing, so the letters stream away. The grid therefore carries a second channel, a disturbance that the stroke sets to 1 and that decays in place over the Heal time (3 s by default). It is sampled at each particle's home, so a cut part of a letter stays released wherever its particles drifted. The spring stays off for the first half of the heal time and eases back over the second. A tether brings the spring back beyond about 1.8 cursor radii from home, so parted material banks up beside the cut like displaced water. - A bow wave that cuts one clean channel. Around the moving cursor a short-range bow wave also suppresses the spring and pushes particles aside, so whatever you point at stays visible. Like the splat it is a capsule over the frame's whole pointer travel, pushing along the stroke's normal, so a fast stroke or a dropped frame cuts one channel rather than a chain of round holes. Its push fades to zero at the centreline, which leaves no hairline crack, and the bow fades 0.6 s after you stop, so a resting cursor never leaves a hole.
- No vorticity confinement in the wake. Confinement normalises ∇|ω|, so its force flips direction wherever that gradient changes sign. Across a straight stroke that terraced the jet into slices and sheared neighbouring particles into strands. With curl 0 the wake parts the letters as one smooth laminar fold, which is how Igloo's particles behave.
- Rank-matched targets, so morphs flow. Each shape is sampled to exactly N points. The points are split into 64 vertical strips that each hold exactly N/64 of them (x-quantiles of the ink), and each strip is sorted top to bottom. Particle i therefore lands at the same strip and the same height rank in every shape. F's particles become L's, the bottom of a word becomes the bottom of the next one, and the swarm flows locally instead of exploding into a criss-cross. The rank doubles as a colour coordinate, so the Neon gradient runs across every word for free and the colours stream through the current intact.
- Crisp letters from stratified samples of the anti-aliased glyph. Samples are stratified on a lattice, one per cell, jittered across the whole cell. They are accepted where the bilinearly interpolated alpha crosses 0.5, which puts edges at sub-pixel accuracy from a canvas drawn at no more than 1600 px. Stratification gives an even fill, where plain random sampling would leave Poisson grain inside the strokes. Full-cell jitter removes the moiré a regular lattice shows once the current shears it. A sequential selection pass keeps exactly N samples without disturbing their order.
- Divergence-free current. The dissolved swarm rides v = (∂ψ/∂y, −∂ψ/∂x) of two octaves of gradient noise with analytic derivatives (Bridson et al. 2007). The curl of a potential has zero divergence, so the swarm never clumps into sinks or tears into holes; plain noise as velocity would. The field breathes by rotating its lattice gradients, and the angle wraps at 2π, with an integer multiple per octave so the wrap never jumps. A gentle drift term opens the closed 2D streamlines into a current. Near particles ride about 20% faster than far ones: enough for depth, not enough to shear the sheets into strands.
- Streaks that join up. A fast particle crosses 20–30 px a frame. Drawn as a dot into a fading trail buffer it leaves a dotted line. Drawn as a uniform streak, a moving edge leaves a staircase of bands, each 20% dimmer than the last. Each particle is drawn as a Gaussian capsule over exactly this frame's travel, with brightness graded from 1 at the head to the trail's per-frame fade
fat the tail. Successive frames then join into one continuous exponential. The energy is divided by the capsule's integral, using the mean of fu, which is (f − 1)/ln f. - Silk, not hair. A trail draws each particle as a comet. Where a sheet is stretched, neighbouring comets stop overlapping and the sheet resolves into strands and dots. Three energy-conserving widenings keep it continuous. First, each streak is sized by the density around it in the previous frame. The alpha of the bloom pyramid's quarter-resolution level (kept out of the up passes) gives ρ, and σ grows by √(0.35/ρ), up to 3×. This is SPH's adaptive smoothing length, and formed letters sit at ρ ≈ 1, so they never widen. Second, a moving streak widens across its direction of travel, up to 3× at 0.5 screen heights per second. Third, a particle comes into focus only over its final 0.08 screen heights of approach. The light each particle carries never changes, so a sparse sheet reads as a thin film rather than as separate dots.
- Energy conservation everywhere. Each particle deposits a fixed energy, computed from the ink area of the shape it is forming, so every word and glyph lands at density ≈ 1. During a morph each particle switches from the outgoing shape's energy to the incoming one's as its own formation envelope rises, so no shape forms greyer or brighter than another. That holds whatever the particle count, point size, streak length, defocus, trail length or buffer scale. Changing any of those changes only the texture, never the exposure. A defocused particle spreads the same light thinner, which is why letters seem to snap into focus as they land. σ grows with distance from the target, and grows faster for particles far from the focal depth.
- Stable at any setting. Damping and drag are integrated implicitly, v' = (v + dt·a)/(1 + dt·c), and position semi-implicitly. Any stiffness from 2 to 24 rad/s, any damping ratio and any frame time up to 1/30 s converges, and 120 Hz screens get the same motion as 60 Hz. The fluid grip is refresh-rate corrected, and the trail fade is
0.01^(dt/T). - The page never opens blank. At load the first word is pre-dissolved: 48 hidden update steps, 1.6 s of current at 1.8× speed. The first frame is already silk ribbons. They sweep into the word, which is legible about 2–3 s after load while the ghost cursor wades through it, and the ghost's wake then lingers for the heal time.
- Precision where it matters. Positions are RGBA32F, because half floats would quantise them to about 1.25 px at 2560. They are read with
texelFetch, never filtered. All blending happens in RGBA16F; iOS has noEXT_float_blend, so 32-bit blending is never needed. The wake grid is half float with LINEAR filtering, which is core on every WebGL2 device. - Two composites from one density. On dark backgrounds a per-channel exponential tonemap lets dense cores whiten like film, and the bloom pyramid screens a soft halo on top. On light backgrounds the same density becomes Beer-Lambert ink, and the pyramid's coverage channel, offset down and to the right by 0.5% of the screen height, becomes a soft cast shadow. Both are dithered with interleaved gradient noise, so neither bands.
- The controls never hide the effect. When the panel opens, the targets are scaled and offset into the part of the stage the panel leaves free, eased along with the panel's slide. On a phone that is above the docked panel; on desktop it is beside the side panel. Tuning any control therefore shows the word. In portrait the words are drawn up to 1.6× taller, as a condensed display cut, so on a 390 px phone a word fills about 18% of the screen height rather than a thin band.
Parameters
Custom words: choose Custom and type shapes separated by / (or spaces). {drop}, {ring} and {spark} are glyphs. Up to six shapes of up to 14 characters each.
Presets
Performance & compatibility
- Measured on the verification harness in serial, locked, uncontended runs on an Apple M5 (Chrome, 2560×1440 canvas, 262,144 particles): 60 fps through the scripted pointer sweep, with 0.1–0.17 ms of JS per frame. Four full runs of the final build (Monochrome) read 6.7–9.8 ms mean and 12.2–14.2 ms p95 of GPU time per frame. One-preset runs read 9.2 / 12.6 ms for Monochrome, 10.1 / 13.7 ms for Neon and 8.7 / 13.1 ms for Ink. Repeat runs of one build vary by up to 3 ms on the mean and 2 ms on the p95. The original page read 9.6 / 13.7 ms for Monochrome.
- What that figure tracks: timed at full GPU clock instead (one timer query around ten back-to-back runs of a pass, on a deterministic 60 Hz replay of the harness's pointer path), the render (fade, streaks, bloom, composite) costs 3.1–3.3 ms at the heaviest sweep frames, against 4.2–4.6 ms in the previous revision and 5.5–6.1 ms in the original page. The rest of the frame (wake, update) adds about 0.5 ms. The harness's per-frame figure does not follow that work. In the same harness window, pages that draw a fixed load of known full-clock cost read 3.4 / 7.3 ms (mean / p95) for 1.0 ms of work, 6.2 / 10.5 for 1.8 ms, 8.9 / 13.1 for 2.5 ms, 10.6 / 13.2 for 3.3 ms, 10.4 / 14.4 for 4.8 ms and 11.1 / 13.7 for 6.3 ms. Adding a fixed 3 ms of full-clock work to this page took it from 9.5 / 13.8 to 11.2 / 13.7. This revision's 20–31% cut at the heaviest frames left the reading where it was: in an interleaved A/B, before read 8.9 / 13.9 and after read 9.5 / 13.8. So the figure follows the work only below about 2 ms. Above that it sits near 10 / 13–14 ms, whatever the load. That fits the GPU picking a lower clock for a lighter frame, though the page cannot see the clock. A p95 under 10 ms would need less than about 1.8 ms of full-clock work in every frame, and the 262,144 streak quads alone take 0.7–1.2 ms before any pixel is shaded. Real users still get the cut: less power on an M-series Mac, and a shorter frame on a GPU that is already at full clock.
- Where the time goes: the streak pass. With colour writes masked, the same draw still costs 0.7–1.2 ms (vertex work and binning). The rest is fragment work that grows with the number of screen tiles each quad touches and the outputs it carries, not with shading math. A fragment shader with less arithmetic but one more interpolated output was 5–19% slower. Moving the per-particle setup (σ, density lookup, hash, palette, energy) into the update pass, which runs it once per particle instead of four times, saved nothing. So the per-particle constants travel as three flat, half-packed words, and only the σ-scaled local coordinates are interpolated. That needs the first-vertex convention, because ANGLE emulates GL's last-vertex rule for flat outputs by rewriting the draw, which made the pass two to three times slower. And the wide streaks (σ ≥ 1.6 px and σ across ≥ 3 px: the fast, smeared silk, about 80% of the quad area mid-sweep) go to a half-res region of the same buffer, in the same draw. There they touch a quarter of the tiles. They are drawn with σ² reduced by the 0.5 px² of extra spread that the region's bilinear upsampling adds back, so they land the same size. Their light is scaled by 0.95, because added onto brighter full-res pixels these faint, overlapping streaks lose part of it to half-float rounding, and in their own region they lose less. That cuts the render by 20–31% at the heaviest frames (43% in Ink, whose larger points send more streaks there). Mean luminance stays within 0.8% at the same replayed moments, and frame-to-frame stability is unchanged. Culling every streak whose own peak is under 0.5/255 was tried and removed 27–56% of the light mid-sweep: the silk is made of many faint streaks overlapping. The two regions share one texture so that the frame stays at 15 render passes, because crossing 16 cost 5–6 ms in the same harness. The wake's splat and divergence share one pass (two targets), its ten Jacobi iterations fold into one 302-tap stencil, and the gradient subtraction folds into the advection. The quarter-res bloom level doubles as the density map, so no copy pass is needed.
- What scales it: the particle count, through the streak quads and the update pass. 1M measured 22 ms mean and ran at about 50 fps, so 1M is for big GPUs. Point size, defocus and how stretched the sheets are scale the quads. The HDR buffer is capped at 2.1 MP, so a 5K display costs about the same as 1440p. The wake grid's three small passes cost 0.3–0.5 ms at full clock, and they are skipped entirely about 7.6 s after the last stroke. That is the heal time or 7.1 s, whichever is longer, plus a 0.5 s fade-out, so nothing snaps when the grid sleeps. GPU memory at the default is about 57 MB: 8 MB of state (ping-pong), 12.6 MB of targets, 28 MB of HDR atlas (full-res region, guard band and half-res region), 6.6 MB of bloom (including the quarter-res up target) and 1.2 MB of wake grid (five 228×128 RGBA16F targets).
- Adaptive quality: if the median GPU frame over the first ~3 s exceeds 12 ms, the page steps down once from its default 262k to 131k, and the Particles control shows it. A shader keeps every other particle, which preserves the rank matching. The switch waits for the moment every particle has let go of its shape, so the swarm just thins out without a jump. A count you pick yourself is never overridden.
- Requirements: WebGL2 with
EXT_color_buffer_float, for the RGBA32F particle state and the RGBA16F buffers. Without it the page shows a message over the poster frame.WEBGL_provoking_vertexis optional: with it the streak pass sends flat, half-packed outputs; without it the same image comes from plain interpolated outputs, at some extra GPU cost. If the GPU's texture size limit cannot hold the HDR atlas (about 1.7× the buffer's short side), every streak is drawn at full resolution. - Mobile: touch devices offer 16k, 33k and 65k particles, defaulting to 65k. A phone's words hold only about 60k ink pixels, so more particles would add cost without detail. Portrait words are drawn up to 1.6× taller and sit a little above centre. When the controls dock to the bottom of the screen, the word glides up into the space above them. In the harness's 390 px phone emulation (DPR capped at 2, a 780×1688 canvas, the HDR buffer at full resolution) the touch drag ran at 60 fps. Dragging parts the letters exactly as the cursor does.
- Reduced motion: a still of the first word, fully formed and in focus, with a Play anyway button. The page is ambient while it is on screen, because the morph cycle is the content. It stops rendering when it scrolls out of view or the tab is hidden.
- Gallery thumbnail (
?embed): 65,536 particles at DPR 1, with the ghost cursor crossing the words every few seconds.
References & credits
- Robert Bridson, Jim Hourihan & Marcus Nordenstam, “Curl-Noise for Procedural Fluid Flow”, SIGGRAPH 2007. cs.ubc.ca. Paper. The source of the divergence-free current and the speed/scale relation.
- Inigo Quilez, “Gradient noise derivatives”. iquilezles.org. Article. The analytic derivative of quintic-faded gradient noise, re-derived and written for this page.
- Jos Stam, “Stable Fluids”, SIGGRAPH 1999, and Mark Harris, “Fast Fluid Dynamics Simulation on the GPU”, GPU Gems ch. 38. developer.nvidia.com. The hidden wake grid.
- Pavel Dobryakov, WebGL-Fluid-Simulation. github.com/PavelDoGreat. MIT. Reference for the WebGL stable-fluids pass structure; no code copied.
- Igloo Inc (abeto) and Emotion Agency. igloo.inc, emotion-agency.com. Their GPGPU particle scenes are pushed by a small hidden fluid, with the return spring weakened by local fluid speed. Observed in their public bundles (see
research/site-survey.md); no code or assets used. - Mark Jarzynski & Marc Olano, “Hash Functions for GPU Rendering”, JCGT 2020. jcgt.org. The PCG hash used for per-particle randomness and lattice gradients.
- Jorge Jimenez, “Next Generation Post Processing in Call of Duty: Advanced Warfare”, SIGGRAPH 2014 (Advances in Real-Time Rendering). iryoku.com. Talk slides; no code used. Interleaved gradient noise dither and the down/up bloom pyramid structure.
- J. J. Monaghan, “Smoothed Particle Hydrodynamics”, Annual Review of Astronomy and Astrophysics 30, 1992. doi.org. Paper. The adaptive smoothing length (kernel width ∝ ρ−1/d) behind the density-sized streaks.
- Edan Kwan / Lusion, The Spirit (MIT), and David Li, Flow (MIT). github.com/edankwan, github.com/dli. Read for GPGPU particle conventions (RGBA32F state, pre-warming); no code copied.
- Look benchmark: the servicetitan.com/max hero (Kevin Levron's TubesCursor, ISC). Nothing from it is used here.
- Research notes:
research/gpgpu-particles.md(the morph-swarm candidate) andresearch/site-survey.mdin this library. Everything on this page is implemented from scratch for the FX library.