SdfSigned Distance Field

Mathematical & Geometric · Scale 4

Signed Distance Field

A function that returns, for any point in space, the distance to the nearest surface — negative inside, zero on it, positive outside. Resolution-independent shapes, smooth booleans, morphing. The gem of modern graphics math, and a clear hint at what 'compose via algebra' looks like.

What it is

An SDF is not stored geometry — it's a way to evaluate geometry. A sphere is the function `length(p) − r`. A box is a few absolute values and a max. A torus is two `length` calls and a subtraction. You never write down the surface; you write down a function that, given any point in space, can tell you how far away the surface is.

The signed part is the trick — the function returns a negative number inside the surface, positive outside, zero on it. That sign carries enough information to do almost everything: union two shapes by taking the minimum of their distances. Intersect by taking the maximum. Subtract by negating one and intersecting. And — the operator that gives SDFs their visual signature — `smin(a, b, k)` smoothly blends two shapes with controllable softness. A sphere and a cube blended with smin look organic. Two spheres look like a peanut. Math becomes sculpture.

Inigo Quilez published the modern canon of SDF primitives at iquilezles.org around 2008 and has been refining it since. Every shader artist on Shadertoy stands on his shoulders. Beyond art: Valve uses distance fields to render text crisply at any zoom (the trick behind every modern variable font). Dreams on PS4 lets players sculpt entire worlds in SDF. Houdini's volumetric tools speak SDF natively.

Why it matters here

SDF sits at the centre of a paradigm we want the polyglot patch system to embrace: image-as-function, not image-as-pixels. You don't store the result; you store the recipe. Rasterisation is deferred until the moment of output, at whatever resolution that output needs. The same SDF renders crisply at a 144×144 thumbnail and a 4K poster — no upscaling, no aliasing, no resolution decisions baked into the asset.

The other thing SDFs teach: composition as algebra, not as compositing. When you want to merge two SDFs you don't paste one on top of the other — you combine them through an operator. The operator carries meaning. Hard min is intersection. Smooth min is melting. Subtraction is carving. The operator is the creative move; the operands are just vocabulary. That pattern — operator-rich composition rather than layer-rich pasting — is exactly what we want Producer's pipelines to look like.

Where SDF lives

The territory is broader than its art-shader reputation suggests. Different communities arrive at SDFs from different doors — typography, games, fabrication, scientific computing — and each has built useful tools.

Inigo Quilez (iquilezles.org)

The canon. Distance-function primitives, smooth booleans, ray marching, the lot. Required reading.

Shadertoy

Where SDF art lives in public. Search 'SDF' for thousands of working examples — many under 200 lines.

Valve / variable fonts

Distance-field text rendering is why your titles stay crisp at any zoom. The whole modern font pipeline depends on this.

Dreams (PS4)

A whole creative game built on SDF sculpting. Demonstrates that SDFs can be a primary creative medium, not just a rendering trick.

Houdini VDB / SDF SOPs

Production VFX pipelines use SDFs for procedural geometry, fluid sims, and volumetric effects. Native, fast, well-documented.

Three.js + raymarched shaders

Bring SDF rendering into a normal web page. The Twigl / glslEditor crowd live here.

What this teaches Producer

  1. Composition is an operator, not a paste. Producer's mental model today is 'pipeline step A → output → step B'. The SDF model is 'A and B combined via operator C, where C carries meaning'. Smooth-min between two prompts. Hard-min between two regions. Subtraction as masking. We should be naming and exposing operators as first-class composition primitives, not hiding composition behind generic 'and then'.
  2. Defer rasterisation. The SDF stays a function until something asks it for pixels at a specific resolution. Producer's vector / scene / typographic / mathematical nodes should pass functional representations, not premature rasters. The polyglot media bundle should carry both — raster bytes for nodes that need them, vector / function representations for nodes that can stay symbolic. Render at output, not at every step.
  3. Soft blending is a creative primitive. The smoothness parameter `k` in `smin(a, b, k)` is a knob that goes from 'two distinct shapes touching' to 'one organic blob'. That dial is creatively expressive. Producer should expose similar smoothness/intensity controls as first-class operators on every binary composition (cross-fade between two style embeddings; gradient between two palettes; soft union of two regions in a layout). Right now most of these are afterthought parameters; they should be part of the vocabulary.
  4. Resolution independence is more valuable than it sounds. For courseware, marketing, brand systems, multi-channel publishing — the asset that renders sharply at 144px AND at print resolution from one source is a structural advantage, not just a nicety. SDFs (and the whole functional family — SVG, typography, scene graphs, Mermaid) get this for free. Wherever we can keep a Producer pipeline functional rather than rasterised, we should.

Try it yourself

The minimum interesting SDF, in three operations: float sdCircle(vec2 p, float r) { return length(p) - r; }

And the smooth-minimum operator that gives SDFs their language: float smin(float a, float b, float k) { float h = clamp(0.5 + 0.5*(b-a)/k, 0., 1.); return mix(b, a, h) - k*h*(1.-h); }

Composes with

Other cells in the table — most still to be walked into in coming sessions.