The function
Think of a 3D scene as a function. You pass in a point in space, it tells you something about that point.
For a signed distance field (SDF), the function tells you:
How far is this point from the nearest surface, and am I inside or outside?
More precisely: the value it returns is literally the Euclidean distance from p to the nearest surface point, in world units, with a sign indicating side:
sdf(p) > 0→ outside the shape; value = distance to surfacesdf(p) = 0→ on the surfacesdf(p) < 0→ inside the shape; value = -(distance to surface)
The "signed" part is the sign bit. The "distance" part is a real distance, not a proxy. This seemingly small commitment ("the number is literally a metric distance") is what makes everything else about SDFs work.
Why the literal-distance property matters
Three consequences fall out for free:
1. Rendering is cheap. You can march rays from a camera pixel into the scene, stepping forward by sdf(p) at each step. Guaranteed the largest step you can take without hitting anything. Every raymarch function on Shadertoy uses this.
2. Geometry is composable. Union: min(sdfA(p), sdfB(p)). Intersection: max(sdfA, sdfB). Subtraction: max(sdfA, -sdfB). Smooth blends are similarly closed-form. Clean, differentiable, no mesh booleans required.
3. ML loves it. Instead of learning a mesh (topology annoying) or voxels (memory expensive), a neural network can learn the scalar function itself. DeepSDF, NeRF, and their descendants all lean on this.
Visualizing the full field
Same idea in 3D. Remember: an SDF is a function defined everywhere in space, not just on the surface. Below is a uniform 3D grid of points where each point shows the SDF value sampled at its position. Color encodes signed distance via a diverging ramp: deep red far inside, orange/yellow as you approach the surface from inside, near-white right at the surface (sdf = 0), then cyan/blue moving outward, deep blue at the far edges. The solid mesh in the center is the actual surface.
Drag to orbit. Use the slice slider to bisect the volume and see the interior structure. Turn on iso-shells to overlay concentric surfaces of constant distance. Switch shapes to see how the field changes.