Feature Library

Stone inlay: the page as a polished slab

1.94 GPU · 0.52 CPU ms
A still of the Stone inlay: the page as a polished slab demo
Still
The live demo starts when it’s in view.Move the light · drag across the slab to inlay a line · L for the loupe, M U P X its light, the wheel zooms

The whole page becomes one slab of polished stone behind ordinary DOM.

What it costs a frame

1.94 ms
0.52 ms
GPU
1.94 ms
CPU, median
0.52 ms
CPU, 95th pct
0.88 ms
Draw calls
0
Weight
Moderate

Measured 14 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 0.92–1.95, CPU 0.48–0.62 ms). What ran: Measured with the loupe on in Magnify, the key light and the lens circling the slab, while a line of malachite is inlaid a segment every sixth frame (mask repaint, jump flood, and the bake scissored to that segment); every frame relights the slab from the baked stone and draws the stone under the glass live. 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.940.520.88
apple · Apple A19 Proin a browser tab · 16 November 20263.550.3838.7
Intel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258Vin a browser tab · 15 November 20262.231.071.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.

How steadily it runs on Intel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258V · in a browser tab

Typical frame ?
16.60 ms
1% low ?
55 fps
Varies by ?
±0.45 ms
All metricsIntel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258V · in a browser tab
p50p95p9916.02 ms18.16 ms +
How long each frame took. Most frames sit in the tall bars; a long tail to the right is hitching.

Frames run on a 60 Hz timer (a page demo), so most frames take about one tick, 16.7 ms: the spread around it is what matters.

Frames

Median (p50) ?
16.60 ms
p95 ?
17.57 ms
p99 ?
18.06 ms
Slowest ?
18.89 ms
Mean ?
16.68 ms
Standard deviation ?
0.45 ms
1% low ?
55 fps
0.1% low ?
53 fps
Hitches ?
0 of 600
Over budget ?
0 of 600

Main thread

Long tasks ?
0
Long frames ?
0
Event-loop delay ?
0.1 / 1.5 / 1.7 ms

Input

No input during this run. A browser-tab run plays none.

Memory

JavaScript heap ?
86.3 → 92.8 MB
Growth ?
+6.48 MB

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 luxury or showcase page whose panels are cut from stone
  2. Charts and diagrams drawn as inlay: bars, rings and lines of stone set in gold
  3. A collector’s, jeweller’s or museum page with a loupe that reads the fine print
  4. A puzzle or crafting game: pieces dropping into sockets cut in a slab
  5. Any page where a Canvas 2D path should become a real material with smooth edges

Pitfalls, in brief

  1. Give [data-stone] elements a transparent background: the stone is drawn under them.
  2. Coordinates are CSS px from the host’s top left: the host must be positioned (relative, absolute or fixed) and the canvas must cover exactly its box.
  3. The mask holds a shape’s index a byte, with two check bytes beside it, so 255 shapes at most.
  4. invalidate(box) bakes only that box (plus bevels and the lifted shadow): it promises nothing else changed.
  5. The bake is light-independent: moving the light, the tilt, the sweep and the loupe only relight.
7 more in brief
  1. Under the loupe the stone is drawn live, so a big lens at a high zoom costs the most: about a full bake of its circle every frame it moves.
  2. Keep the clone in line: the loupe clones the page once (refresh()), so call it again after the page’s text or layout changes.
  3. Never more than one frame on the GPU: frame() skips while the last one is in flight and keeps what changed for the next.
  4. The pipelines compile in the background before the first frame; the canvas is blank for that moment, never frozen.
  5. A device lost later (a driver reset, a laptop waking) stops the slab: pass onLost, then make a fresh canvas and a slab with webgpu: false, and say so, as the demo does.
  6. The loupe places its clone where content sits in the host, at its size and scroll; nested scrolling boxes inside the content are cloned unscrolled.
  7. Text over stone is not checked for contrast by the stone: keep body text on honed tiles (calm veins) and away from the gold bundles of the ground.
12 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.

Guodong Rong & Tiow-Seng Tan, Jump Flooding in GPU with Applications to Voronoi Diagram and Distance Transform (I3D 2006): The edge distance field: seeds on every edge between two shapes, then steps of 16, 8, 4, 2, 1, 1 texels.

Mark Jarzynski & Marc Olano, Hash Functions for GPU Rendering (JCGT, 2020): The PCG hash behind every noise, cell and the seeded rosette.

Ken Perlin, gradient noise (1985) and its quintic fade (2002); Steven Worley, A Cellular Texture Basis Function (1996): The marble clouds and veins; malachite’s rings, lapis’s pyrite and the ground’s crackle.

Feature Library, material designer (Polished marble, White marble, Carved jade): The vein recipe (a sine of a warped coordinate, sharpened by a power) and the jade’s layered clouds follow its presets.

Bruce Walter et al., Microfacet Models for Refraction (EGSR 2007); Christophe Schlick (1994): GGX highlights with Schlick’s Fresnel and visibility.

Inigo Quilez, 2D distance functions: The rounded box’s signed distance, the exact edge every tile and its wire are drawn from.

stonemarblehardstone inlayinlaygoldjump flooddistance fieldsdfrounded boxloupemagnifierdom + gpupolishreflectionsdeferredg-bufferscissorraw webgpuwgslcanvas 2d fallbackdraw on demandtimestamp queriesno dependencies

Near it in the frame