CoACD Approximate Convex Decomposition × Shape matching (meshless deformation)
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.
Open in StudioReproduced27.4× · 0.851 ms
Verified proof

Split-screen WebGL2 proof comparing a single global convex-hull shape-matching cluster that treats a concave arch-and-limb prop as one stiff brick (left) against CoACD concavity-aware convex decomposition feeding overlapping polar-decomposed shape-matching clusters with articulated hinge bending and plastic yield (right).
Chromium Headless ANGLE/SwiftShader WebGL2 · 512x512 · partitions concave limbs into 5 CoACD convex clusters with overlapping collars for articulated polar-decomposed bending without rigid global locking
Show GLSL proof (183 lines)
const float P_IMPACT_FLEX = 0.85; // P Hinge Flex [0.1, 1.5, 0.05]
const float P_PLASTIC_YIELD = 0.45; // P Plastic Yield [0.0, 1.0, 0.05]
const float P_COLLAR_SMOOTH = 0.14; // P Collar Blend [0.04, 0.28, 0.02]
const float P_CLUSTER_VIS = 0.72; // P CoACD Tint [0.0, 1.0, 0.05]
mat2 rot2(float a) {
float c = cos(a), s = sin(a);
return mat2(c, -s, s, c);
}
float sdCapsule(vec3 p, vec3 a, vec3 b, float r) {
vec3 pa = p - a, ba = b - a;
float h = clamp(dot(pa, ba) / max(dot(ba, ba), 1e-5), 0.0, 1.0);
return length(pa - ba * h) - r;
}
float sdRoundBox(vec3 p, vec3 b, float r) {
vec3 q = abs(p) - b;
return length(max(q, 0.0)) + min(max(q.x, max(q.y, q.z)), 0.0) - r;
}
// Smooth minimum returning (blended distance, blend weight)
vec2 sminW(float a, float b, float k) {
float h = max(k - abs(a - b), 0.0) / max(k, 1e-5);
float m = h * h * 0.5;
float s = m * k * 0.5;
return (a < b) ? vec2(a - s, m) : vec2(b - s, 1.0 - m);
}
// Concave articulated arch-and-limbs sculpture with CoACD cluster ID tracking
vec2 mapProp(vec3 p, float t, bool useCoACD) {
float cycle = sin(t * 2.2);
float bounce = abs(cycle);
float impact = pow(1.0 - bounce, 2.2) * P_IMPACT_FLEX;
float squashY = -0.35 + bounce * 0.42;
// Base translation onto floor
vec3 q = p - vec3(0.0, squashY, 0.0);
if (!useCoACD) {
// Left baseline: single global shape-matching frame -> mild uniform tilt/squash, zero limb articulation
q.xy = rot2(0.09 * sin(t * 2.2)) * q.xy;
q.y /= (1.0 - impact * 0.09);
q.x *= (1.0 - impact * 0.045);
float torso = sdRoundBox(q - vec3(0.0, 0.25, 0.0), vec3(0.28, 0.22, 0.16), 0.07);
float legL = sdCapsule(q, vec3(-0.24, 0.12, 0.0), vec3(-0.48, -0.45, 0.06), 0.11);
float legR = sdCapsule(q, vec3(0.24, 0.12, 0.0), vec3(0.48, -0.45, -0.06), 0.11);
float armL = sdCapsule(q, vec3(-0.24, 0.34, 0.0), vec3(-0.72, 0.62, 0.10), 0.095);
float armR = sdCapsule(q, vec3(0.24, 0.34, 0.0), vec3(0.72, 0.62, -0.10), 0.095);
float d = min(torso, min(min(legL, legR), min(armL, armR)));
return vec2(d, 0.0);
} else {
// Right: CoACD decomposes into 5 semantic convex clusters with polar-decomposed hinge frames
float yieldBend = P_PLASTIC_YIELD * 0.28;
float legFlex = impact * 0.58 + yieldBend * 0.45;
float armFlex = -impact * 0.72 - yieldBend * 0.65 + 0.14 * cos(t * 2.2);
// Cluster 1: Central torso
vec3 qt = q - vec3(0.0, 0.24 - impact * 0.16, 0.0);
qt.xz = rot2(0.12 * sin(t * 1.1)) * qt.xz;
float dTorso = sdRoundBox(qt, vec3(0.28, 0.22, 0.16), 0.07);
// Cluster 2 & 3: Left and right arched legs rotating around hip collars
vec3 hipL = vec3(-0.24, 0.12 - impact * 0.14, 0.0);
vec3 qlL = q - hipL;
qlL.xy = rot2(-legFlex) * qlL.xy;
float dLegL = sdCapsule(qlL, vec3(0.0), vec3(-0.26, -0.56, 0.06), 0.11);
vec3 hipR = vec3(0.24, 0.12 - impact * 0.14, 0.0);
vec3 qlR = q - hipR;
qlR.xy = rot2(legFlex) * qlR.xy;
float dLegR = sdCapsule(qlR, vec3(0.0), vec3(0.26, -0.56, -0.06), 0.11);
// Cluster 4 & 5: Cantilevered upper arms whipping dynamically with plastic yield
vec3 shL = vec3(-0.24, 0.34 - impact * 0.16, 0.0);
vec3 qaL = q - shL;
qaL.xy = rot2(-armFlex) * qaL.xy;
float dArmL = sdCapsule(qaL, vec3(0.0), vec3(-0.50, 0.28, 0.10), 0.095);
vec3 shR = vec3(0.24, 0.34 - impact * 0.16, 0.0);
vec3 qaR = q - shR;
qaR.xy = rot2(armFlex) * qaR.xy;
float dArmR = sdCapsule(qaR, vec3(0.0), vec3(0.50, 0.28, -0.10), 0.095);
// Overlapping collar blending between adjacent CoACD clusters
float k = P_COLLAR_SMOOTH;
float d = dTorso;
float cid = 1.0;
vec2 m1 = sminW(d, dLegL, k); if (m1.y > 0.5) cid = 2.0; d = m1.x;
vec2 m2 = sminW(d, dLegR, k); if (m2.y > 0.5) cid = 3.0; d = m2.x;
vec2 m3 = sminW(d, dArmL, k); if (m3.y > 0.5) cid = 4.0; d = m3.x;
vec2 m4 = sminW(d, dArmR, k); if (m4.y > 0.5) cid = 5.0; d = m4.x;
// Subtle collar seam band marker where two hulls overlap
float minPair = min(abs(dTorso - dLegL), min(abs(dTorso - dLegR), min(abs(dTorso - dArmL), abs(dTorso - dArmR))));
if (minPair < 0.032) cid = 6.0;
return vec2(d, cid);
}
}
vec3 calcNormal(vec3 p, float t, bool useCoACD) {
vec2 e = vec2(0.0025, -0.0025);
return normalize(
e.xyy * mapProp(p + e.xyy, t, useCoACD).x +
e.yyx * mapProp(p + e.yyx, t, useCoACD).x +
e.yxy * mapProp(p + e.yxy, t, useCoACD).x +
e.xxx * mapProp(p + e.xxx, t, useCoACD).x
);
}
vec3 clusterColor(float cid) {
if (cid < 0.5) return vec3(0.54, 0.56, 0.60);
if (cid < 1.5) return vec3(0.84, 0.52, 0.26);
if (cid < 2.5) return vec3(0.24, 0.64, 0.72);
if (cid < 3.5) return vec3(0.32, 0.72, 0.46);
if (cid < 4.5) return vec3(0.76, 0.36, 0.52);
if (cid < 5.5) return vec3(0.56, 0.44, 0.84);
return vec3(0.96, 0.92, 0.72);
}
vec3 acesTone(vec3 x) {
return clamp((x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14), 0.0, 1.0);
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 res = max(iResolution.xy, vec2(1.0));
vec2 uvN = fragCoord / res;
float splitX = iMouse.z > 0.0 ? clamp(iMouse.x / res.x, 0.05, 0.95) : 0.5;
bool useCoACD = uvN.x > splitX;
vec2 p = (fragCoord - 0.5 * res) / res.y;
float t = iTime;
float camAng = 0.28 * sin(t * 0.4);
vec3 ro = vec3(sin(camAng) * 2.85, 0.58, cos(camAng) * 2.85);
vec3 ta = vec3(0.0, -0.05, 0.0);
vec3 fw = normalize(ta - ro);
vec3 ri = normalize(cross(vec3(0.0, 1.0, 0.0), fw));
vec3 up = cross(fw, ri);
vec3 rd = normalize(fw * 1.65 + ri * p.x + up * p.y);
vec3 bg = mix(vec3(0.08, 0.09, 0.12), vec3(0.18, 0.21, 0.27), clamp(p.y + 0.55, 0.0, 1.0));
vec3 col = bg;
vec3 L = normalize(vec3(0.58, 0.82, 0.48));
// Floor plane at y = -0.82
float floorT = (-0.82 - ro.y) / (abs(rd.y) < 1e-5 ? 1e-5 : rd.y);
float maxD = 12.0;
if (floorT > 0.01 && rd.y < -0.005) {
maxD = min(maxD, floorT);
vec3 fp = ro + rd * floorT;
float chk = mod(floor(fp.x * 2.5) + floor(fp.z * 2.5), 2.0);
vec3 fAlb = mix(vec3(0.20, 0.21, 0.24), vec3(0.28, 0.29, 0.33), chk);
float aoShadow = smoothstep(0.15, 1.25, length(fp.xz));
col = mix(fAlb * (0.35 + 0.65 * aoShadow), bg, 1.0 - exp(-floorT * 0.14));
}
float d = 0.0;
float hitCid = -1.0;
for (int i = 0; i < 64; i++) {
vec2 resMap = mapProp(ro + rd * d, t, useCoACD);
if (resMap.x < 0.002) {
hitCid = resMap.y;
break;
}
d += resMap.x * 0.85;
if (d > maxD) break;
}
if (hitCid >= 0.0) {
vec3 wp = ro + rd * d;
vec3 N = calcNormal(wp, t, useCoACD);
vec3 V = -rd;
float ndl = max(dot(N, L), 0.0);
float fill = max(dot(N, normalize(vec3(-0.6, 0.3, -0.5))), 0.0);
float fres = pow(1.0 - max(dot(N, V), 0.0), 3.2);
float spec = pow(max(dot(N, normalize(L + V)), 0.0), 48.0);
vec3 baseMat = vec3(0.55, 0.57, 0.62);
vec3 alb = mix(baseMat, clusterColor(hitCid), useCoACD ? P_CLUSTER_VIS : 0.15);
col = alb * (0.20 + 0.92 * ndl + 0.24 * fill) + vec3(0.95, 0.96, 1.0) * (spec * 0.45 + fres * 0.22);
}
col = acesTone(col * 1.08);
if (abs(fragCoord.x - splitX * res.x) < 1.0) col = vec3(0.95, 0.93, 0.89);
fragColor = vec4(pow(clamp(col, 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
}Why they connect
CoACD Approximate Convex Decomposition splits a concave triangle mesh along collision-aware cutting planes into a compact set of convex parts that respect natural limbs, hinges, and cavities. The hop to Shape matching (meshless deformation) is composite: convert each convex hull plus a thin collar of shared boundary vertices across cutting planes into a shape-matching particle cluster, compute each cluster's rest center of mass and covariance matrix, and feed those clusters into Shape matching (meshless deformation) so every step extracts optimal rigid or quadratic goal frames via polar decomposition and blends shared-collar particles back to smooth elastic or plastic motion.
How to build it
Preprocess a concave mesh with CoACD at a moderate concavity threshold (e.g., 0.05-0.1) to obtain 8-32 convex sub-hulls. Sample or reuse mesh vertices inside each hull as simulation particles, duplicating boundary-plane adjacency links so neighboring CoACD parts share an overlapping ring of particles (creating natural flexible hinges without rigid snapping). At runtime, integrate particle velocities under gravity and collisions, compute each cluster's deformed covariance matrix A_pq = sum m_i (x_i - c)(q_i - q0)^T, extract rotation R via 4-6 iterations of fast quaternion polar decomposition, optionally update rest positions q_i past a yield threshold for permanent denting, and pull particles toward goal positions g_i = R(q_i - q0) + c.
Field marks
- Zero-overlap cutting planes let adjacent CoACD hulls drift apart cleanly unless collar sharing or inter-cluster distance springs are enforced.
- Very small convex shards containing nearly coplanar vertices produce singular covariance matrices during polar decomposition.
- Over-aggressive concavity thresholds spawn dozens of tiny clusters that increase stiffness mismatch across thin necks or handles.
- Visual mesh triangles straddling a CoACD cut require smooth dual-cluster skinning weights to avoid creasing artifacts.
Prior art
No prior art found on 2026-12-01.
Searches run (2)
- arXiv: all:"CoACD" AND all:"shape matching"
- GitHub repos: "CoACD" "shape matching"