Feature Library

A clay sheet you press, pinch and smooth

1.68 GPU · 0.34 CPU ms
A still of the A clay sheet you press, pinch and smooth demo
Still
The live demo starts when it’s in view.Press, pinch, smooth or drag the clay · two fingers squeeze a ridge · on the sheet: arrows, hold Space, 1–4, [ ], Ctrl+Z

A slab of clay on a linen board that keeps every touch.

What it costs a frame

1.68 ms
0.34 ms
GPU
1.68 ms
CPU, median
0.34 ms
CPU, 95th pct
0.75 ms
Draw calls
0
Weight
Moderate

Measured 13 November 2026 on RTX 4060 Laptop, 13th Gen Intel(R) Core(TM) i9-13900H, Chrome 157, 1920×1080 at 1×. 600 frames × 3 rounds, median kept (rounds ranged GPU 1.03–3.39, CPU 0.29–0.34 ms). What ran: Measured while a pressing finger travels round the slab and drags clay behind it (dirty rows uploaded as half floats, one full-canvas pass with a 14-step shadow march), timed by its own timestamp queries. Phones: tiers are being measured next.

On every machine it was measured on
MachineGPU msCPU msCPU p95
RTX 4060 Laptop · 13th Gen Intel(R) Core(TM) i9-13900Hreference · measuring tool1.680.340.75
apple · Apple A19 Proin a browser tab · 16 November 20269.600.500.58
Intel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258Vin a browser tab · 15 November 20261.570.500.77

Bars against one 16.7 ms frame. A browser-tab run is timed in a visible tab without the tool’s scripted input, so read it as close, not exact.

What it needs

Renders with
WebGPUNeeds WebGPU: current Chrome and Edge, Safari 26+, Firefox 141+ on Windows.
Your browser
Checking…Looking for WebGPU
Depends on
NothingNo other packages

What it’s for

  1. A tactile toy or a calm, hands-on moment in an app
  2. A sculpting or stamping surface: seals, dimples, signatures pressed in
  3. A material for a game: a dough, a putty, a wax or a sand tray
  4. Teaching volume that is kept: whatever you push down rises somewhere else
  5. A soft height field to build terrain brushes on

Pitfalls, in brief

  1. Every tool moves clay; none adds or removes it.
  2. Heights and widths share one unit (cells), so a slope is a real slope: the slump threshold (repose) and the shading read it directly.
  3. Diffusion that keeps volume moves flux between pairs of neighbours, each pair once, from a copy of the heights: updating cells in place from their already-updated neighbours leaks or makes clay and smears the result toward the loop’s direction.
  4. A drag carries clay at most a cell a step: longer strokes are cut into steps, or the carried clay jumps over cells and leaves stripes.
  5. Upload only the rows an edit touched.
6 more in brief
  1. r16float is filterable, r32float is not without the float32-filterable feature: half floats let the hardware do the bilinear taps the bicubic filter is built from.
  2. The shading reads the grid with a cubic filter and the shadow with plain bilinear taps; a shadow marched over the cubic heights costs four times as much for no visible gain.
  3. Two touches always squeeze, whatever the tool: on a phone that is the gesture people try first.
  4. One stroke is one undo step: snapshot when the first pointer or the Space key goes down, keep it only if something changed, and push it when the last one comes up.
  5. When a tool has nowhere to put what it took (a pinch centred on bare board), give back exactly the amounts taken, kept per cell.
  6. Draw on demand: the tools report what moved and when the clay has settled (busy), and nothing draws in between.
11 pitfalls in full, the hook-up guide, the module source and its tests come with the part.

Where it comes from

From HaTac. Fully custom code.

Christian Sigg & Markus Hadwiger, Fast Third-Order Texture Filtering (GPU Gems 2, ch. 20, 2005): The cubic B-spline from four bilinear fetches that gives the coarse grid smooth normals.

Mark Jarzynski & Marc Olano, Hash Functions for GPU Rendering (JCGT, 2020): The PCG hash behind the grain and the grog.

Angle of repose (granular mechanics): The slump rule: a step steeper than the material holds moves a share of its excess downhill, as in sandpile models (Bak, Tang & Wiesenfeld, 1987).

claysculptheight fielddeformpresspinchsmoothsmearmass conservingangle of reposetouchmulti-touchkeyboardundobicubicsoft shadowshalf floatraw webgpuwgslcanvas 2d fallbackdraw on demandtimestamp queriesno dependencies

Near it in the frame