Pick any shape — a circle, a rounded box, a letter "A". Now assign every point in the plane a single number: the distance to the nearest point on the shape's boundary. Points outside get a positive number; points inside get the same distance but negative; points exactly on the surface get zero.
That function is a Signed Distance Field (SDF).
The sign is the whole trick. Positive means "outside," negative means "inside," and the zero level set is the shape itself. You never need to store the boundary explicitly — the shape is implicit in the function's level sets. Want to shrink or grow the shape? Add a constant to the function. Want a rounded corner? Clamp the distance. Want to blend two shapes into one smooth blob? Take the minimum of their SDFs (or a smooth approximation of it). All of these operations are a line of math, not a mesh edit.
SDFs were popularized in computational geometry and computer graphics alike. Valve used them in 2007 to render crisp vector-quality text on GPU hardware at a fraction of the cost of traditional methods. Ray marchers — algorithms that step along a ray until — turn an SDF into a raytracer with a loop of a dozen lines. And because the function is analytic, the surface normal at any point is simply the gradient — no triangle soup required.
This article unpacks how SDFs are defined, why blending works, and where you will find them quietly running the graphics on your screen right now.
Comments
Loading comments...