Showroom Β· Make-of
How Tidepool was made
A painting pool where the medium is a real fluid simulation. Drag pours ink and momentum into water solved live on the GPU β nothing is a brush texture.
View the site βWhat it demonstrates
That a browser can run honest computational physics, not just play back an effect. The curls, blooms, and filaments are never drawn β they emerge from an incompressible NavierβStokes solver stepping about sixty times a second in WebGL2 fragment shaders. It also demonstrates resilience: mobile browsers reclaim GPU contexts constantly, and this page recovers instead of leaving a dead canvas.
Techniques, honestly named
- Stable fluids β Jos Stam's classic solver: semi-Lagrangian advection backtraces each texel along the velocity field, which keeps the simulation unconditionally stable at large time steps.
- Vorticity confinement β the curl field feeds a small corrective force that re-energizes whirls numerical dissipation would otherwise smear away.
- Jacobi pressure projection β about twenty relaxation iterations per frame solve for pressure; subtracting its gradient keeps the water incompressible.
- Ping-ponged half-float textures β velocity at ~144 px, dye at ~1024 px, each double-buffered; requires the EXT_color_buffer_float extension.
- Splat injection β pointer events (mouse, pen, multi-touch) stamp a Gaussian of momentum and ink where you drag; a Ripple button stirs the pool from the keyboard.
- PNG export β the context keeps its drawing buffer, so Save PNG is one canvas.toBlob call at full canvas resolution.
- Context-loss recovery β webglcontextlost is intercepted and every GPU resource is rebuilt on restore, so the pool survives the context resets that are routine on phones.
- Respectful fallbacks β prefers-reduced-motion skips the opening swirl; the loop pauses when the tab is hidden; devicePixelRatio is capped at 2; browsers without WebGL2 float rendering get a plain-spoken styled notice.
Recreate it
The full recreation prompt β the solver passes with their exact constants, the texture formats and resolutions, all four palettes with hexes, the toolbar spec, and the quality bar including context-loss recovery β is in the showroom vault.