FRAGMENTS
Technology

Raymarching Is the New Typography

How signed-distance functions are quietly reshaping layout, motion, and interface on the modern web.

Kai Nakamura · December 14, 2023 · 9 min read

I spent three weeks last November rewriting our layout engine through the lens of signed-distance functions. What began as an experiment — could we describe component boundaries the way a shader buffer describes a sphere? — became the most productive technical pivot since adopting CSS Grid. The core insight is deceptively simple: every UI element has a distance field, and that field is composable.

Code as Interface

float d = sdSphere(p - center, radius); vec3 col = iridescent(normalize(p), fresnel);

The iridescent shimmer in modern WebGL demos is not decoration — it is a Fresnel computation, light refracting at glancing angles. When we began deriving color tokens the same way — generating hover states and elevation shadows from a single spectral input instead of twenty-four hand-picked hex values — our system shrank by sixty percent. Fewer tokens, richer expression.

This is the WebGL Shader Iridescent (2023) design system, applied by Curio Design — a design-style library for AI agents. Full WebGL Shader Iridescent (2023) guide → designbycurio.com/learn/webgl-shader-iridescent-2023