home/ atoms/ sdf-exact-vs-approximate

Exact SDFs give the true Euclidean distance; approximate SDFs are safe lower bounds but force smaller marching steps

Not all signed distance functions give the true shortest distance. An exact SDF returns the precise Euclidean distance to the nearest surface, letting the raymarcher take the maximum safe step at each iteration. An approximate SDF only guarantees a lower bound — it never overestimates the distance, so the marcher stays safe, but may take much smaller steps than necessary, raising iteration count and lowering performance. IQ’s distance-functions article notes that boolean subtraction and intersection of exact SDFs produce approximate (not exact) SDFs, while union and XOR preserve exactness (in the exterior). Knowing whether your SDF is exact matters for performance tuning and for correct soft-shadow and ambient-occlusion calculations.

Examples

sdSphere and sdBox are exact. Subtraction max(-d1, d2) and intersection max(d1, d2) produce approximate SDFs; union min(d1, d2) remains exact.

Assessment

Explain the practical consequence of using an approximate SDF versus an exact one in a raymarcher, and name two SDF boolean operations that break exactness.

“The following block of functions are NOT correct and true SDFs. Instead they do approximate SDFs in some sense or another”