Local Optimization for Robust SDF Collision
Finds exact deepest-penetration contact points between arbitrary triangle meshes and signed distance fields using fast per-triangle Frank-Wolfe local optimization, enabling robust GPU rigid-body physics without convex hull decomposition.
Also known as SDF Rigid-Body Collision
In the family Simulation & animation, collision
Where it runs
Built inOfficial add-onPluginNone foundNot researched
| Engine | Support | How |
|---|---|---|
| three.js r187 | None found | Custom GPU Frank-Wolfe triangle-SDF contact solver; requires custom physics/compute integration. |
| Babylon.js 9.x | None found | Custom GPU Frank-Wolfe triangle-SDF contact solver; requires custom physics/compute integration. |
| Godot 4.7 | None found | Custom GPU Frank-Wolfe triangle-SDF contact solver; requires custom physics/compute integration. |
| Unity 6.0 | None found | Custom GPU Frank-Wolfe triangle-SDF contact solver; requires custom physics/compute integration. |
| Unreal 5.7 | None found | Custom GPU Frank-Wolfe triangle-SDF contact solver; requires custom physics/compute integration. |
| Blender 5.0 | None found | Custom GPU Frank-Wolfe triangle-SDF contact solver; requires custom physics/compute integration. |
| WebGPU W3C | None found | Custom GPU Frank-Wolfe triangle-SDF contact solver; requires custom physics/compute integration. |
| Metal | None found | Custom GPU Frank-Wolfe triangle-SDF contact solver; requires custom physics/compute integration. |
How it works
Naive vertex-against-SDF collision misses edge-edge and face-face penetrations when large triangles collide with curved or sharp SDF features. Macklin et al. formulate contact detection for each triangle-SDF pair as minimizing the SDF value over the triangle's barycentric domain via a few iterations of Frank-Wolfe / projected gradient descent on the GPU. This locates true deepest-penetration interior and edge contacts smoothly in constant time per triangle without subdividing meshes or authoring manual convex hulls.
When to choose it
Use for real-time GPU rigid-body simulation, cloth-against-environment contact, or destructible geometry where arbitrary concave meshes collide cleanly against static or dynamic SDFs.
Field marks
- SDF voxel grid resolution limits thin-wall accuracy unless paired with narrow-band/sparse grids
- Non-convex local minima inside a single huge triangle may still require coarse triangle subdivision
- Static SDF baking assumes non-deforming collider shapes
Presets
SDF Collision — continuous distance field iso-contours with closest-point contact projection
{
"P_BOUNCE": 0.65,
"P_RADIUS": 0.22
}Show GLSL (32 lines)
const float P_BOUNCE = 0.65; // P Drop Speed [0.1, 1.8, 0.05]
const float P_RADIUS = 0.22; // P Body Radius [0.12, 0.34, 0.01]
float sdBowl(vec2 p) {
float d1 = abs(length(p - vec2(0.0, 0.18)) - 0.62) - 0.04;
float box = max(abs(p.x) - 0.85, p.y - 0.05);
return max(d1, -box);
}
vec2 gradBowl(vec2 p) {
float e = 0.002;
return normalize(vec2(sdBowl(p + vec2(e, 0.0)) - sdBowl(p - vec2(e, 0.0)), sdBowl(p + vec2(0.0, e)) - sdBowl(p - vec2(0.0, e))));
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
float d = sdBowl(uv);
// Iso-distance contour field
vec3 col = mix(vec3(0.05, 0.08, 0.14), vec3(0.14, 0.22, 0.34), 0.5 + 0.5 * sin(d * 60.0));
col = mix(col, vec3(0.86, 0.82, 0.74), smoothstep(0.012, 0.003, abs(d)));
// Animated rigid circle with local closest-point contact projection
float t = iTime * P_BOUNCE;
vec2 c = vec2(sin(t) * 0.32, -0.18 + abs(cos(t * 1.4)) * 0.35);
float distC = sdBowl(c);
vec2 n = gradBowl(c);
if (distC < P_RADIUS) c += n * (P_RADIUS - distC);
vec2 cp = c - n * sdBowl(c);
float body = smoothstep(P_RADIUS + 0.006, P_RADIUS - 0.006, length(uv - c));
col = mix(col, vec3(0.95, 0.52, 0.24), body * 0.9);
float cpDot = smoothstep(0.024, 0.012, length(uv - cp));
col = mix(col, vec3(0.35, 0.98, 0.62), cpDot);
fragColor = vec4(pow(clamp(col, 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
}Attribution: MIT — written for this index.
Measured GPU weight
Not yet timed in the standardized NVIDIA T4 sweep. Run the browser profiler above, or time all live specimens at 1080p in Google Colab (NVIDIA T4).
Lineage
Sources
- primaryMiles Macklin, Kenny Erleben, Matthias Müller, Nuttapong Chentanez, Stefan Jeschke, Zach Corse (2020). Local Optimization for Robust Signed Distance Field Collision. Proceedings of the ACM on Computer Graphics and Interactive Techniques.Verified via crossref · 2026-12-02doi:10.1145/3384538