# Merging/Clipping Signed Distance Fields

I have multiple separate shapes for which I have generated signed distance fields by merging and clipping them against each other. Is there a generic analytical solution for merge and clip operations of signed distance fields?

For example, the result of clipping a horizontal and vertical edge, producing the convex corner (green), the MAX operation results in a correct shape interior, but incorrect exterior. The points in the bottom-right quadrant of the image have values closer than they should. This is the result of the formerly-closest points no longer being present in the post-clipped image.

The correct SDF should look like this, with the bottom-right quadrant being a conic/radial shape, as for all points in that quadrant, their closest point is the shape corner itself.

• Interesting question! I don't think there is an exact analytical solution, but you could probably figure out something approximate and reasonable-looking by using a first-order approximation: Take the SDF values $\phi_i(x)$ and gradients $\nabla\phi_i(x)$ at the current point $x$, construct half-spaces $S_i=\{y:\phi_i(x)+(y-x)\cdot\nabla\phi_i(x)\le0\}$, and take the distance from $x$ to their intersection.
– user106
Oct 3, 2018 at 6:56