Most familiar 3D models describe a surface explicitly. A polygon mesh stores vertices and the faces that connect them. A parametric patch maps coordinates such as and to positions on a surface. Both approaches answer a version of the same question: where is the geometry?
A signed distance field, or SDF, reverses the relationship. Give it any point in space and it returns a number. The magnitude is the shortest distance to the boundary; the sign classifies the point as inside or outside. The surface itself is where the answer is zero.
That change in viewpoint makes clearance queries, normals, offsets, Boolean composition, ray tracing, deformation, and learned shape families direct operations on a scalar function. This article develops the field mathematics and then connects it to Rig Cad’s hybrid SDF-and-mesh workflow.
A shape defined everywhere
Let be a solid region with boundary . First define the unsigned distance from a point to that boundary:
Using the common negative-inside convention, when , and when . The opposite sign convention is also used, so implementations should always state which one they follow. With the convention above:
- means the point is inside;
- means the point is on the boundary;
- means the point is outside; and
- is the Euclidean distance to the closest boundary point. This is richer than a generic implicit function.
For example: both and describe a sphere of radius . Only the second expression returns geometric distance from the sphere.
The first has the correct zero set but its values away from the surface are algebraic quantities, not distances.
Three exact examples
Simple shapes often have compact analytical SDFs.
Table: Exact signed distance functions for three primitives.
| Shape | Parameters | Exact SDF |
|---|---|---|
| Sphere | Center and radius: | |
| Plane | Unit normal and offset: | |
| Axis-aligned box | Center, half-sizes, and helper vector: |
For the box, absolute value, maximum, and subtraction on bold vectors are componentwise. The first term handles exterior distance to the nearest face, edge, or corner; the second supplies the negative interior distance to the nearest face.
The information hidden in the field
The zero level set
is the visible surface, but neighboring level sets are useful too. When the level-set value is positive, describes an outward offset by distance . In Rig Cad, the Surface Offset option available on every node inside an SDF branch is exactly this: it shifts the level set that becomes the surface without touching a single vertex. Negative level sets describe inward offsets where they exist; near the medial axis, they can develop singularities, merge, or disappear.
Where the SDF is differentiable, it satisfies the eikonal equation
At smooth boundary points, the normalized gradient gives the outward surface normal:
For an exact, differentiable SDF, the denominator is one. In numerical work it is usually retained because sampled, interpolated, composed, or learned fields are rarely exact.
An SDF is continuous, but it is not differentiable everywhere. If a point has more than one equally close boundary point, the direction to the surface is ambiguous. Inside the solid, such points lie on the medial axis; more generally they form part of the cut locus. The crease in the distance field is not a defect; it records the internal symmetry of the shape.
Building shapes with functions
Suppose and represent two solids using negative-inside SDFs. Familiar set operations have remarkably short formulas:
Table: Boolean composition of negative-inside signed distance fields.
| Operation | Field formula |
|---|---|
| Union, | |
| Intersection, | |
| Difference, | |
| Complement of |
In the editor, the first three rows are the same Operation choices on a Boolean once its SDF Mode is on; the complement row is the Complement post-processing step. These rules make constructive solid geometry feel like scalar arithmetic. A sphere can be subtracted from a box, repeated, rounded, or blended without explicitly rebuilding a polygon mesh after every operation.
There is an important qualification. The min and max formulas preserve the correct inside/outside classification and zero boundary, and they provide useful distance bounds for sphere tracing. But the resulting field is not necessarily the exact Euclidean distance to the combined surface everywhere, particularly near intersections and internal seams. Smooth minimum functions can replace hard unions to create rounded blends, but they change both the geometry and the distance property. Rig Cad exposes that family as the Smooth width and Blend Mode on an SDF Boolean: quadratic, cubic, and quartic polynomial blends, a circular fillet, a chamfer, stepped stairs and columns, and a few others, each a different function of the two distances. Reinitialization or a fresh distance computation may be required when exact distances matter.
Moving and scaling an SDF
SDF transformations are most naturally expressed by transforming the query point back into the shape’s local coordinate system.
Table: How rigid motions and uniform scale transform a field.
| Transformation | New field |
|---|---|
| Translation by | |
| Rotation | |
| Uniform scale |
Translation and rotation preserve distance because they are rigid motions. Uniform scaling requires multiplying the returned value by . Nonuniform scaling, twisting, bending, and other deformations are less convenient: a transformed implicit function can still have the correct zero set without remaining an exact SDF. Practical renderers often compensate with conservative distance bounds.
Sphere tracing: letting distance choose the step
One of the best-known uses of SDFs is sphere tracing, introduced by John C. Hart for rendering implicit surfaces.[1] A camera ray can be written as
where is its origin and is a unit direction. At a sampled point, the absolute SDF value is the radius of an empty sphere that cannot contain the surface. The ray can therefore advance by that amount without stepping through the first intersection.
t = 0
repeat:
p = origin + t * direction
step = abs(sceneSDF(p))
if step < tolerance: report a hit
t = t + step
until t exceeds the view limit or the step limit
Far from geometry, sphere tracing takes large steps through empty space. Near a surface, the steps shrink until they meet the chosen tolerance. It handles shapes that would be awkward to triangulate and scenes assembled from nested functional operations.
The guarantee depends on the field. A true distance function is safe, and a conservative signed distance bound can also be safe. An arbitrary implicit function—or an SDF distorted by an unsafe transformation—may overestimate clearance and cause the ray to skip through thin features.
Surfaces that move and change topology
Distance fields are also central to level set methods. Instead of explicitly moving mesh vertices, a surface is carried as the zero contour of a higher-dimensional scalar field. A common evolution equation is
where is the speed of the interface in its normal direction. The speed can depend on curvature, position, material properties, an external flow, or image data.
This Eulerian description handles topological events naturally. Two expanding surfaces can merge, a neck can pinch apart, and a hole can appear without changing a mesh connectivity table. Osher and Sethian’s foundational work used Hamilton–Jacobi formulations to track fronts whose motion depends on curvature, with applications including crystal growth and flame propagation.[2]
As the field evolves numerically, it may stop satisfying . Many solvers therefore periodically reinitialize the field, restoring distance-like values while preserving the zero level set.
How distance fields are represented
An SDF is a continuous idea, but computers must choose a representation.
Table: Representations of a distance field and their trade-offs.
| Representation | Strength | Limitation |
|---|---|---|
| Analytical function | Compact, exact for supported primitives, resolution independent | Complex shapes need many operations or special formulas |
| Dense grid | Simple sampling and interpolation; works with arbitrary geometry | Memory grows cubically with resolution in 3D |
| Narrow-band grid | Stores detail only near the surface | Long-range distance queries need special handling |
| Adaptive tree or sparse grid | Concentrates samples where detail requires them | More complex traversal and interpolation |
| Neural field | Continuous learned representation; can encode shape families | Evaluation and training cost; distance and sign may be approximate |
Adaptively sampled distance fields, introduced by Frisken and colleagues, reduce storage by sampling the field finely near detailed regions and coarsely where it changes predictably.[3] Sparse grid structures follow a similar principle for simulation and visual effects.
More recently, systems such as DeepSDF have used neural networks to approximate a continuous signed distance function. A network receives a 3D coordinate—often together with a latent code describing a particular object—and predicts the signed distance. This makes it possible to reconstruct incomplete shapes, interpolate between examples, and represent an entire learned class of geometry rather than one fixed object.[4]
The word “SDF” should still be used carefully in learned systems. Unless distance constraints are enforced successfully, the network may reproduce the correct zero surface without satisfying the eikonal equation or returning accurate metric distance away from it.
Powerful, but not effortless
Signed distance fields exchange explicit topology for continuous queries. That trade is not always advantageous.
High-resolution 3D grids can consume enormous amounts of memory. Sampling and interpolation can erase small features or shift the zero crossing. Determining a reliable sign from an open, non-manifold, or self-intersecting mesh is difficult. Sharp corners create nondifferentiable regions, and Boolean operations or deformations can destroy exact distance behavior. Converting the result back to a mesh introduces another approximation through algorithms such as marching cubes or dual contouring.
The best implementation therefore depends on the task. A triangle mesh remains excellent for rasterization and explicit surface editing. An analytical SDF is ideal for compact procedural geometry. Sparse sampled fields work well for large, evolving volumes. Neural fields trade direct storage for learned inference. Many modern systems combine several representations rather than treating one as universal.
How Rig Cad combines SDF and mesh geometry
Rig Cad combines SDF and mesh geometry in a single modeling workflow. Use SDFs for organic forms, smooth blends, lattices, offsets, and other field-defined structures; use mesh-based operations where crisp, explicitly modeled features matter.
The multi-kernel showcase above demonstrates the central design idea: a scalar field can define the shape, while mesh conversion and conventional operations prepare it for downstream editing, visualization, and manufacturing. In that project the union colored yellow in the viewport is the SDF branch (a smooth union with a gyroid pattern intersected into a sphere); the difference above it stays on the mesh kernel. The goal is not to make one representation universal, but to move between representations without losing the strengths of either.
In the object tree, click the purple diamond on a Boolean to turn on SDF Mode and solve that branch as a field. Its descendants turn purple and pick up SDF options. The controls map directly onto the sections above:
- Smooth and Blend Mode choose the smooth-minimum function that replaces the hard
minandmax. - Surface Offset on any node in the branch shifts its level set, .
- Precision on the root of the SDF branch is the sampling resolution; descendant precision values do not override it. Bounds Padding enlarges the evaluation box so a blend or offset near its edge is not clipped.
- Engine selects how the field becomes triangles: Rust Adaptive is usually fastest, Adaptive v2 uses a topology-safe QEF, and Rust LevelSet prioritizes closed, manifold solids and can run on the GPU within a voxel budget. Decimation then thins the extracted mesh.
Two neighbors of this article pick the thread up: Oversize the Cutter explains why a smooth subtraction needs a cutter that clears the blend band, and Post-Processing in Rig Cad covers the three field-only steps—Complement, Infill, and Surface Pattern—that operate on the branch after it is solved. Mesh Cleanup in Rig Cad has SDF Remesh, which runs the reverse trip: a troublesome mesh is sampled into a field and re-extracted as a clean one.

Next steps
Continue with Gyroid TPMS: When Geometry Becomes Structure, which develops an implicit level-set equation into a tunable engineering and decorative surface, and with Pattern 3D: Lattices, Infill, and Surface Textures, the node that ships more than 150 such patterns. The cube law behind Precision, the difference between the engines, and what to do when a field branch takes seconds to solve are the subject of Why Is My Model Slow?; the smooth-minimum blends measured against the other rounding routes are in Fillets and Chamfers.
If you think in Blender's Geometry Nodes, Geometry Nodes, Displacement, and the Implicit Tree maps that graph onto the purple diamond. Within Rig Cad, apply the same field principles when choosing smooth operations, precision, mesh conversion, and extraction settings, and keep field-defined construction separate from later result-level processing and final mesh validation.

Comments
Loading comments...