home/ atoms/ sdf-smooth-blending

The smooth minimum (smin) blends two SDFs with a controllable rounded join instead of a sharp union

Combining two signed distance fields with plain min(d1, d2) produces a boolean union with a sharp crease where the surfaces meet. The smooth minimum (smin) replaces the discontinuous min with a function that transitions over a controllable blend radius k: within k units of the intersection the two distances are interpolated, so the joined surface reads as a smooth rounded merge. The polynomial form measures how close the two distances are, blends them proportionally, and subtracts a correction term; the result is still (approximately) a valid SDF, so the same shading logic applies. Larger k gives a wider, softer blend; as k approaches 0 the join sharpens back toward plain min(). This is the core operator for building organic, blobby forms — heads and bodies, limbs, metaball-style merges — out of simple primitives. Its boolean siblings (smooth intersection, smooth subtraction) add the same k parameter to the other set operations.

Examples

float smin(float a, float b, float k){
  float h = clamp(0.5 + 0.5*(b-a)/k, 0.0, 1.0);
  return mix(b, a, h) - k*h*(1.0-h);
}
// blend two spheres into one continuous shape
float d = smin(sdSphere(p-headPos, 0.5), sdSphere(p-bodyPos, 0.3), 0.15);

Assessment

Given two spheres 0.5 units apart blended with smin k=0.3, describe how the surface differs from plain min() and what happens as k approaches 0. Then modify a scene that uses min(d1,d2) for union to use smooth union, and state what visually changes at the boundary.

“smooth minimum, which takes care of blending things together. And actually, I can show you in graph toy a little bit”
corpus · inigo-quilez-live-coding-happy-jumping-video · chunk 7
“rst to use the [smooth minimun formula](https://iquilezles.org/articles/smin) to blend shapes together (legs and body). It also pe”
corpus · inigo-quilez-raymarching-signed-distance-fields-article · chunk 3
“Smooth union: combine two shapes together, but smoothly blend the edges where they meet.”
corpus · shadertoy-tutorial-nathan-vaughn-inspirnathan · chunk 1