Feature Library

Procedural card material

0.58 GPU · 0.20 CPU ms
A still of the Procedural card material demo
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.

On every machine it was measured on
MachineGPU msCPU msCPU p95
RTX 4060 Laptop · 13th Gen Intel(R) Core(TM) i9-13900Hreference · measuring tool0.580.200.30
apple · Apple A19 Proin a browser tab · 16 November 20265.850.500.62
Intel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258Vin a browser tab · 15 November 20261.700.550.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

  1. Premium cards and tiles
  2. Trading cards and badges
  3. Product and finish pickers
  4. UI panels with real materials
  5. Logos in metal

Pitfalls, in brief

  1. 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.
  2. 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).
  3. Keep the finish’s numbers in uniforms: switching finish then never builds a shader (the demo’s seven cards share one).
  4. 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.
  5. 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
  1. 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.
  2. 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.

pbrggxclearcoatiridescenceanisotropyglitterholographictslno textures

Near it in the frame