Feature Library
3.60 GPU · 0.20 CPU ms
A still of the Glass engraving demo
Still
The live demo starts when it’s in view.Drag or use the arrow keys to turn the block · Enter to engrave again

Laser engraving inside a block of glass: any word or mask becomes a cloud of tiny fractures, written by the laser layer by layer from the bottom up, seen…

What it costs a frame

3.60 ms
0.20 ms
GPU
3.60 ms
CPU, median
0.20 ms
CPU, 95th pct
0.29 ms
Draw calls
0
Weight
Heavy

Measured 11 November 2026 on 13th Gen Intel(R) Core(TM) i9-13900H, Chrome 157, 1920×1080 at 1×. 600 frames × 3 rounds, median kept. What ran: The block turning at 9°/s while the word is engraved over and over (low quality, 60k points): the points and their mirror images splatted in one compute pass, the studio traced through the glass with dispersion, one composite pass; timed with its own timestamp queries. Phones: tiers are being measured next.

On every machine it was measured on
MachineGPU msCPU msCPU p95
unknown GPU · 13th Gen Intel(R) Core(TM) i9-13900Hreference · measuring tool3.600.200.29
apple · Apple A19 Proin a browser tab · 16 November 20261.890.560.68
Intel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258Vin a browser tab · 15 November 20264.390.390.54

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. Awards, trophies and keepsakes in a configurator
  2. Product shots and hero sections
  3. Title cards and splash screens
  4. Loading moments with a progress to show
  5. Museum and exhibition pieces

Pitfalls, in brief

  1. The points’ picture is a storage buffer of three u32s a pixel at the canvas’s full size (about 25 MB at 1080p): cap the canvas’s pixels (the demo keeps it under 2.4 MP).
  2. Draw at the canvas’s own width and height: size it (CSS size × devicePixelRatio) before drawing, or it draws at 300 × 150.
  3. Building a cloud is CPU work (a distance transform and a sort: about 50–150 ms for 120k points): build it once per mask, not per frame, and debounce typing.
  4. A long word is scaled down to fit maxWidth (20 cm): its capitals come out smaller than height.
  5. The flashes are timed from how fast progress moves: drive it smoothly (a jump looks like a very fast laser), and keep drawing while busy is true so the last flashes fade.
2 more in brief
  1. Only the walls’ strong (total internal) reflections are drawn as images; the faces’ few per cent are left out, or they would lay a ghost over the engraving.
  2. Without WebGPU createGlassEngraving returns null: draw drawEngravingStill on a 2D canvas instead.
7 pitfalls in full, the hook-up guide, the module source and its tests come with the part.

Where it comes from

From SpaciousPro. Fully custom code.

Pedro Felzenszwalb & Daniel Huttenlocher, Distance Transforms of Sampled Functions (2012): The signed distance the cloud keeps its points inside the walls by is their 1D squared-distance transform, run along columns then rows.

Mark Jarzynski & Marc Olano, Hash Functions for GPU Rendering (2020): Their PCG hash (from Melissa O’Neill’s PCG family) replaces the original shader’s and the cloud’s generators.

Marching squares: The outlines are traced the classic way, the 2D case of Lorensen & Cline’s marching cubes (1987), with the saddle cells resolved by their middle.

Fresnel equations, Snell’s law and the method of images: Textbook optics: unpolarised reflectance, the bend through each face solved by Newton’s method, and the walls’ reflections drawn as a lattice of mirrored copies of the block.

glassrefractiondispersiontotal internal reflectionpoint cloudlaserwgslraw webgpucomputeray tracing

Near it in the frame