Feature Library

SDF text at any zoom

0.09 GPU · 0.41 CPU ms
A still of the SDF text at any zoom demo
Still
The live demo starts when it’s in view.Click, then scroll to zoom · drag to pan · edit the paragraph in the box

Crisp text at 2% or 6400%: glyphs rasterised on first use with Canvas 2D, turned into signed distance fields by an exact distance transform, packed into one…

What it costs a frame

0.09 ms
0.41 ms
GPU
0.09 ms
CPU, median
0.41 ms
CPU, 95th pct
0.54 ms
Draw calls
4
Weight
Light

Measured 3 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: Measured while the board zooms slowly in and out over about 900 glyphs (one instanced draw). 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.090.410.54
apple · Apple A19 Proin a browser tab · 16 November 20261.660.340.72
Intel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258Vin a browser tab · 15 November 20260.390.981.31

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. Text on zoomable boards
  2. Labels in 3D scenes and maps
  3. Sticky notes that fit their text
  4. Thousands of labels in one draw
  5. Editors that must wrap like the DOM

Pitfalls, in brief

  1. Load the font before making the atlas (document.fonts.load): a face made earlier measures and draws the fallback font, and its layout will not match the DOM later.
  2. The atlas doubles when it fills: every glyph’s cell is a share of the texture, so rasterise all of a run’s glyphs before computing cells (GlyphText.set does), and point the material at the new texture (growListeners).
  3. Coverage from the field’s screen derivative (fwidth) gives one-pixel edges at any zoom; a fixed smoothstep width blurs when zoomed in and aliases when zoomed out.
  4. Partly covered pixels sit between the inside and outside transforms, so the edge lands where the antialiasing put it: run the transform on the coverage, not a thresholded bitmap.
  5. The quad is the bitmap plus a 6 px buffer: the field needs room to fall off, so glyphs overlap their neighbours’ quads (draw text with depthWrite off).
1 more in brief
  1. Wrapping matches the DOM only with the same font, weight, kerning (normal) and line height (1.3 here): set the editor’s CSS from the same constants.
6 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.

Felzenszwalb & Huttenlocher, Distance Transforms of Sampled Functions (2012): The exact Euclidean distance transform the field is built with. The algorithm, implemented from the paper.

textsdfglyph atlasdistance transformkerninglayoutinstancingtsl

Near it in the frame