Surfaces & materialsProcedural card material
0.58 GPU · 0.20 CPU ms
Still
The live demo starts when it’s in view.Move the pointer over the stage: the cards tilt toward it
One analytic lit surface for every finish.
What it costs a frame
0.58 ms
0.20 ms
- GPU
- 0.58 ms
- CPU, median
- 0.20 ms
- CPU, 95th pct
- 0.30 ms
- Draw calls
- 15
- Weight
- Moderate
Measured 4 November 2026 on RTX 4060 Laptop, 13th Gen Intel(R) Core(TM) i9-13900H, Chrome 156, 1920×1080 at 1×. 600 frames × 3 rounds, median kept. What ran: Seven curved cards, each a full lit surface (GGX with clearcoat, sheen, thin film, anisotropy, flakes and foil in one shader), the large one with a hex pattern pressed into it (three pattern samples a pixel for its slope), swaying slowly. Phones: tiers are being measured next.
| Machine | GPU ms | CPU ms | CPU p95 |
|---|---|---|---|
| RTX 4060 Laptop · 13th Gen Intel(R) Core(TM) i9-13900Hreference · measuring tool | 0.58 | 0.20 | 0.30 |
| apple · Apple A19 Proin a browser tab · 16 November 2026 | 5.85 | 0.50 | 0.62 |
| Intel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258Vin a browser tab · 15 November 2026 | 1.70 | 0.55 | 0.85 |
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
- three.js 0.187.0No other packages
What it’s for
- Premium cards and tiles
- Trading cards and badges
- Product and finish pickers
- UI panels with real materials
- Logos in metal
Pitfalls, in brief
- surface() builds shader variables (toVar, addAssign): call it inside a Fn(), or TSL logs “No stack defined for assign operation” and the card draws wrong.
- Shader compilers inline every call: each piece is written to be used once (the pattern shares its noise between its kinds; the surroundings are uniforms, not branches).
- Keep the finish’s numbers in uniforms: switching finish then never builds a shader (the demo’s seven cards share one).
- Flakes and brushing streaks fade by how many pixels they span (px): pass a real device-pixels-per-unit, or far cards sparkle and crawl.
- The diffuse is normalised to the key light’s height, so a flat card facing the light shows its colour exactly: relief and tilt change it, not the light’s angle.
2 more in brief
- The light rig works in a board’s frame (x right, y down, z out of it): turn it into your scene’s frame (here y is flipped) before handing it to the card’s frame.
- Highlights are soft-clipped toward 1 at the end of surface(): with renderer tone mapping on top they look dull; the demo turns tone mapping off.
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.


