CoACD Approximate Convex Decomposition
Splits a concave mesh into a small set of convex pieces for physics, choosing cuts by a collision-aware concavity measure and a tree search, so thin or interlocking parts stay faithful.
Also known as CoACD, convex decomposition
In the family Geometry, meshing & signed distance fields, collision geometry
Where it runs
Built inOfficial add-onPluginNone foundNot researched
| Engine | Support | How |
|---|---|---|
| three.js r187 | None found | |
| Babylon.js 9.38.0 | None found | |
| Godot 4.7 | None found | Convex decomposition uses V-HACD rather than CoACD. |
| Unity | None found | MeshCollider Convex uses PhysX convex hull cooking rather than CoACD decomposition. |
| Unreal 5.7 | None found | Static Mesh convex decomposition uses V-HACD rather than CoACD. |
| Blender 5.2 | None found | |
| WebGPU W3C | None found | |
| Metal | None found |
How it works
A concavity score measures how far a piece is from its convex hull, but unlike older volumetric measures it is computed from the boundary samples and checks whether the hull would collide with the other pieces (collision-aware). The mesh is recursively cut by planes: a Monte-Carlo tree search proposes planes among candidates, evaluates the concavity of the two resulting parts and picks the sequence of cuts that minimises a global score. Cuts stop once each part's concavity is below a threshold or a part count limit is reached. After cutting, small pieces can be merged if the merged hull remains within tolerance, and a hull simplification step reduces vertex count. The result is a set of convex hulls with limited overlap suitable for rigid body engines.
When to choose it
Reach for it when
- concave mesh collides badly in physics engine
- need collision shapes for a complex rigid body
- thin or interlocking parts lose shape in collision hulls
- generated assets need physics proxies automatically
Choose it to generate collision proxies for dynamic rigid bodies in physics engines, for robotics grasping and for generated assets. Prefer V-HACD style voxel methods when quick, noisy hulls suffice, a single three-mesh-bvh triangle query for static scene queries, and hand-authored primitives when exactness matters (wheels, boxes).
Field marks
- Parts count explodes on organic or noisy meshes unless a limit is set
- Convex hulls are fatter than the shape; thin walls and interior cavities are lost
- Non-watertight inputs produce unreliable concavity estimates
- Result depends on random tree search unless seeded
Presets
CoACD Convex Decomposition — single outer hull (left) vs collision-aware convex pieces (right)
{
"P_EXPLODE": 0.12,
"P_HULL_ALPHA": 0.55,
"P_ROT_SPEED": 0.7,
"P_SPLIT": 0.48
}Show GLSL (154 lines)
const float P_EXPLODE = 0.12; // P Piece Explode [0.0, 0.35, 0.01]
const float P_HULL_ALPHA = 0.55; // P Outer Hull Leak [0.1, 0.9, 0.05]
const float P_ROT_SPEED = 0.70; // P Spin Speed [0.0, 2.2, 0.05]
const float P_SPLIT = 0.48; // P Single Hull / CoACD [0.0, 1.0, 0.02]
mat2 rot2(float a) { float c = cos(a), s = sin(a); return mat2(c, -s, s, c); }
float sdBox(vec3 p, vec3 b) {
vec3 q = abs(p) - b;
return length(max(q, 0.0)) + min(max(q.x, max(q.y, q.z)), 0.0);
}
// Concave mechanical arch/table composed of 6 clean CoACD convex hull components!
vec2 mapCoACD(vec3 p, float explode, float spin) {
vec3 q = p;
q.xz = rot2(spin * 0.58) * q.xz;
q.yz = rot2(0.32) * q.yz;
vec2 res = vec2(1e5, 0.0);
// Piece 1: Top arch beam
float d1 = sdBox(q - vec3(0.0, 0.38 + explode * 1.1, 0.0), vec3(0.68, 0.14, 0.24)) - 0.025;
if (d1 < res.x) res = vec2(d1, 1.0);
// Piece 2: Left pillar
float d2 = sdBox(q - vec3(-0.54 - explode, -0.08, 0.0), vec3(0.14, 0.36, 0.24)) - 0.025;
if (d2 < res.x) res = vec2(d2, 2.0);
// Piece 3: Right pillar
float d3 = sdBox(q - vec3(0.54 + explode, -0.08, 0.0), vec3(0.14, 0.36, 0.24)) - 0.025;
if (d3 < res.x) res = vec2(d3, 3.0);
// Piece 4: Left angled brace
vec3 bL = q - vec3(-0.28 - explode * 0.5, 0.14 + explode * 0.4, 0.0);
bL.xy = rot2(0.785) * bL.xy;
float d4 = sdBox(bL, vec3(0.24, 0.08, 0.18)) - 0.02;
if (d4 < res.x) res = vec2(d4, 4.0);
// Piece 5: Right angled brace
vec3 bR = q - vec3(0.28 + explode * 0.5, 0.14 + explode * 0.4, 0.0);
bR.xy = rot2(-0.785) * bR.xy;
float d5 = sdBox(bR, vec3(0.24, 0.08, 0.18)) - 0.02;
if (d5 < res.x) res = vec2(d5, 5.0);
// Piece 6: Lower base plinths (left & right feet)
float d6 = sdBox(q - vec3(0.0, -0.48 - explode * 0.9, 0.0), vec3(0.76, 0.10, 0.30)) - 0.02;
// Cut center gap so base itself is concave -> split into piece 6 (left foot) and piece 7 (right foot)!
float dFootL = sdBox(q - vec3(-0.52 - explode, -0.48 - explode * 0.7, 0.0), vec3(0.24, 0.09, 0.30)) - 0.02;
float dFootR = sdBox(q - vec3(0.52 + explode, -0.48 - explode * 0.7, 0.0), vec3(0.24, 0.09, 0.30)) - 0.02;
if (dFootL < res.x) res = vec2(dFootL, 6.0);
if (dFootR < res.x) res = vec2(dFootR, 7.0);
return res;
}
// Single naive outer convex hull wrapping the entire concave arch (blocks the hollow archway!)
float mapOuterHull(vec3 p, float spin) {
vec3 q = p;
q.xz = rot2(spin * 0.58) * q.xz;
q.yz = rot2(0.32) * q.yz;
return sdBox(q - vec3(0.0, -0.02, 0.0), vec3(0.76, 0.56, 0.30)) - 0.03;
}
vec3 calcNormal(vec3 p, float explode, float spin) {
vec2 e = vec2(0.0022, 0.0);
return normalize(vec3(
mapCoACD(p + e.xyy, explode, spin).x - mapCoACD(p - e.xyy, explode, spin).x,
mapCoACD(p + e.yxy, explode, spin).x - mapCoACD(p - e.yxy, explode, spin).x,
mapCoACD(p + e.yyx, explode, spin).x - mapCoACD(p - e.yyx, explode, spin).x
));
}
vec3 pieceColor(float id) {
if (id < 1.5) return vec3(0.18, 0.78, 0.88);
if (id < 2.5) return vec3(0.96, 0.52, 0.22);
if (id < 3.5) return vec3(0.24, 0.86, 0.54);
if (id < 4.5) return vec3(0.96, 0.80, 0.22);
if (id < 5.5) return vec3(0.72, 0.44, 0.96);
if (id < 6.5) return vec3(0.94, 0.34, 0.58);
return vec3(0.34, 0.62, 0.98);
}
vec3 aces(vec3 x) {
x = max(x, 0.0);
return (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
float screenX = fragCoord.x / max(iResolution.x, 1.0);
float split = clamp(P_SPLIT, 0.0, 1.0);
bool isCoACD = screenX >= split;
float explode = isCoACD ? clamp(P_EXPLODE, 0.0, 0.38) : 0.0;
float hullAlpha = clamp(P_HULL_ALPHA, 0.1, 0.92);
float spin = iTime * max(P_ROT_SPEED, 0.0);
vec3 ro = vec3(0.0, 0.08, 2.68);
vec3 rd = normalize(vec3(uv, -1.55));
vec3 col = mix(vec3(0.025, 0.035, 0.056), vec3(0.068, 0.088, 0.138), smoothstep(-0.55, 0.55, uv.y));
// Trace concave mesh / CoACD convex pieces
float t = 0.0;
float matId = 0.0;
bool hit = false;
for (int i = 0; i < 64; i++) {
vec2 h = mapCoACD(ro + rd * t, explode, spin);
if (h.x < 0.002) { hit = true; matId = h.y; break; }
t += h.x;
if (t > 8.0) break;
}
if (hit) {
vec3 p = ro + rd * t;
vec3 n = calcNormal(p, explode, spin);
vec3 l1 = normalize(vec3(0.58, 0.84, 0.52));
vec3 l2 = normalize(vec3(-0.70, -0.25, 0.50));
float diff = max(dot(n, l1), 0.0) * 0.85 + max(dot(n, l2), 0.0) * 0.25;
float spec = pow(max(dot(n, normalize(l1 - rd)), 0.0), 46.0);
vec3 alb = isCoACD ? pieceColor(matId) : vec3(0.58, 0.64, 0.74);
col = alb * (0.28 + 0.82 * diff) + vec3(0.95) * spec * 0.45;
}
// On left side: overlay the single coarse convex hull wrapping & blocking the concavity!
if (!isCoACD) {
float tH = 0.0;
bool hitH = false;
for (int i = 0; i < 56; i++) {
float dh = mapOuterHull(ro + rd * tH, spin);
if (dh < 0.0025) { hitH = true; break; }
tH += dh;
if (tH > 8.0) break;
}
if (hitH) {
vec3 ph = ro + rd * tH;
vec2 e = vec2(0.003, 0.0);
vec3 nh = normalize(vec3(
mapOuterHull(ph + e.xyy, spin) - mapOuterHull(ph - e.xyy, spin),
mapOuterHull(ph + e.yxy, spin) - mapOuterHull(ph - e.yxy, spin),
mapOuterHull(ph + e.yyx, spin) - mapOuterHull(ph - e.yyx, spin)
));
float fres = 0.25 + 0.75 * pow(1.0 - max(dot(nh, -rd), 0.0), 2.5);
// Concavity error volume (where hull exists in front of empty archway!) glows warning red-orange
bool isErrorGap = !hit || (tH < t - 0.05);
vec3 hullCol = isErrorGap ? vec3(0.98, 0.22, 0.24) : vec3(0.95, 0.65, 0.22);
float hatch = smoothstep(0.35, 0.65, sin((ph.x + ph.y) * 34.0));
col = mix(col, hullCol * (0.75 + 0.35 * hatch), clamp(hullAlpha * (0.45 + 0.55 * fres), 0.18, 0.85));
}
}
float sep = smoothstep(0.0035, 0.0008, abs(screenX - split));
col = mix(col, vec3(0.95, 0.97, 1.0), sep);
fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
}Attribution: MIT — written for this index.
Measured GPU weight & timing
| Preset | GPU | Weight / p50 / p95 | Method |
|---|---|---|---|
| coacd-convex-decomposition-live | Tesla T4 1920x1080 | 31.2× baseline (heavy) · 0.968 ms / 1.02 ms | opengl-timer-query · 36 frames · GPU Weight Atlas · Colab T4 sweep |
| coacd-convex-decomposition-live | NVIDIA L4 1920x1080 | 28.3× baseline (heavy) · 0.449 ms / 0.464 ms · 2.2× faster on L4 | opengl-timer-query · Cross-architecture validation |
| coacd-convex-decomposition-live | NVIDIA A100-SXM4-40GB 1920x1080 | 19.2× baseline (moderate) · 0.553 ms / 0.573 ms · 1.8× faster on A100 | opengl-timer-query · Cross-architecture validation |
Lineage
From the citation graph (Crossref reference lists): its primary source cites GJK and EPA convex collision detection.
Crosses
- Concavity-aware deformable clusters via CoACD and shape matching: Partitioning arbitrary concave props into tight approximate convex hulls via CoACD automatically builds semantic, crease-respecting overlapping clusters for fast polar-decomposed shape matching and controllable plastic bending.
- Captured rooms you can bump into: Splat captures that behave physically: walk around a real room, drop objects on its tables, knock props over. The splats keep the appearance while their extracted surface, cut into convex hulls, gives a rigid-body solver something to collide with.
- Manifold Mesh Booleans: Boolean cuts split the mesh along candidate planes.
Sources
- primaryXinyue Wei, Minghua Liu, Zhan Ling, Hao Su (2022). Approximate convex decomposition for 3D meshes with collision-aware concavity and tree search. ACM Transactions on Graphics.Verified via doi.org · 2026-11-29doi:10.1145/3528223.3530103
- implementationSarahWeiii (2022). SarahWeiii/CoACD. [SIGGRAPH2022] Approximate Convex Decomposition for 3D Meshes with Collision-Aware Concavity and Tree SearchGitHub API · license MIT · 2026-11-29