{
 "id": "coacd-convex-decomposition",
 "title": "CoACD Approximate Convex Decomposition",
 "aliases": [
  "CoACD",
  "convex decomposition"
 ],
 "domain": "geometry",
 "subdomain": "collision geometry",
 "stage": "geometry",
 "realtime": "offline",
 "platforms": [
  "cpu",
  "python",
  "blender",
  "unity"
 ],
 "year_introduced": 2022,
 "inputs": [
  "mesh"
 ],
 "outputs": [
  "mesh"
 ],
 "style": "both",
 "dynamic": "static",
 "summary": "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.",
 "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_use": "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).",
 "cost": {
  "class": "offline",
  "notes": "Search over cut planes takes seconds to minutes per mesh depending on quality settings."
 },
 "failure_modes": [
  "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"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "doi:10.1145/3528223.3530103",
   "type": "paper",
   "title": "Approximate convex decomposition for 3D meshes with collision-aware concavity and tree search",
   "authors": [
    "Xinyue Wei",
    "Minghua Liu",
    "Zhan Ling",
    "Hao Su"
   ],
   "year": 2022,
   "venue": "ACM Transactions on Graphics",
   "url": "https://doi.org/10.1145/3528223.3530103",
   "ids": {
    "doi": "10.1145/3528223.3530103"
   },
   "license": null,
   "extra": {
    "csl_type": "journal-article"
   },
   "provenance": {
    "title": {
     "authority": "doi.org",
     "endpoint": "https://doi.org/10.1145/3528223.3530103 (CSL-JSON)",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "doi.org",
     "endpoint": "https://doi.org/10.1145/3528223.3530103 (CSL-JSON)",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "doi.org",
     "endpoint": "https://doi.org/10.1145/3528223.3530103 (CSL-JSON)",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "doi.org",
     "endpoint": "https://doi.org/10.1145/3528223.3530103 (CSL-JSON)",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "doi.org",
     "endpoint": "https://doi.org/10.1145/3528223.3530103 (CSL-JSON)",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "wei2022approximate"
  },
  {
   "role": "implementation",
   "key": "gh:sarahweiii/coacd",
   "type": "code",
   "title": "SarahWeiii/CoACD",
   "description": "[SIGGRAPH2022] Approximate Convex Decomposition for 3D Meshes with Collision-Aware Concavity and Tree Search",
   "authors": [
    "SarahWeiii"
   ],
   "year": 2022,
   "venue": "GitHub",
   "url": "https://github.com/SarahWeiii/CoACD",
   "ids": {
    "repo": "SarahWeiii/CoACD"
   },
   "license": "MIT",
   "extra": {
    "stars": 1227,
    "stars_checked": "2026-11-29",
    "archived": false,
    "fork": false,
    "pushed_at": "2026-09-23T20:05:14Z",
    "language": "C++",
    "homepage": "https://colin97.github.io/CoACD/",
    "license_name": "MIT License"
   },
   "provenance": {
    "title": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/SarahWeiii/CoACD",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/SarahWeiii/CoACD",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/SarahWeiii/CoACD",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/SarahWeiii/CoACD",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/SarahWeiii/CoACD",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "license": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/SarahWeiii/CoACD",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": null,
   "__bib": "sarahweiii2022sarahweiii"
  }
 ],
 "presets": [
  {
   "id": "coacd-convex-decomposition-live",
   "title": "CoACD Convex Decomposition — single outer hull (left) vs collision-aware convex pieces (right)",
   "runtime": "glsl-fragment",
   "params": {
    "P_EXPLODE": 0.12,
    "P_HULL_ALPHA": 0.55,
    "P_ROT_SPEED": 0.7,
    "P_SPLIT": 0.48
   },
   "basis": "original",
   "license_note": "MIT — written for this index.",
   "code": "const float P_EXPLODE = 0.12; // P Piece Explode [0.0, 0.35, 0.01]\nconst float P_HULL_ALPHA = 0.55; // P Outer Hull Leak [0.1, 0.9, 0.05]\nconst float P_ROT_SPEED = 0.70; // P Spin Speed [0.0, 2.2, 0.05]\nconst float P_SPLIT = 0.48; // P Single Hull / CoACD [0.0, 1.0, 0.02]\n\nmat2 rot2(float a) { float c = cos(a), s = sin(a); return mat2(c, -s, s, c); }\n\nfloat sdBox(vec3 p, vec3 b) {\n  vec3 q = abs(p) - b;\n  return length(max(q, 0.0)) + min(max(q.x, max(q.y, q.z)), 0.0);\n}\n\n// Concave mechanical arch/table composed of 6 clean CoACD convex hull components!\nvec2 mapCoACD(vec3 p, float explode, float spin) {\n  vec3 q = p;\n  q.xz = rot2(spin * 0.58) * q.xz;\n  q.yz = rot2(0.32) * q.yz;\n\n  vec2 res = vec2(1e5, 0.0);\n\n  // Piece 1: Top arch beam\n  float d1 = sdBox(q - vec3(0.0, 0.38 + explode * 1.1, 0.0), vec3(0.68, 0.14, 0.24)) - 0.025;\n  if (d1 < res.x) res = vec2(d1, 1.0);\n\n  // Piece 2: Left pillar\n  float d2 = sdBox(q - vec3(-0.54 - explode, -0.08, 0.0), vec3(0.14, 0.36, 0.24)) - 0.025;\n  if (d2 < res.x) res = vec2(d2, 2.0);\n\n  // Piece 3: Right pillar\n  float d3 = sdBox(q - vec3(0.54 + explode, -0.08, 0.0), vec3(0.14, 0.36, 0.24)) - 0.025;\n  if (d3 < res.x) res = vec2(d3, 3.0);\n\n  // Piece 4: Left angled brace\n  vec3 bL = q - vec3(-0.28 - explode * 0.5, 0.14 + explode * 0.4, 0.0);\n  bL.xy = rot2(0.785) * bL.xy;\n  float d4 = sdBox(bL, vec3(0.24, 0.08, 0.18)) - 0.02;\n  if (d4 < res.x) res = vec2(d4, 4.0);\n\n  // Piece 5: Right angled brace\n  vec3 bR = q - vec3(0.28 + explode * 0.5, 0.14 + explode * 0.4, 0.0);\n  bR.xy = rot2(-0.785) * bR.xy;\n  float d5 = sdBox(bR, vec3(0.24, 0.08, 0.18)) - 0.02;\n  if (d5 < res.x) res = vec2(d5, 5.0);\n\n  // Piece 6: Lower base plinths (left & right feet)\n  float d6 = sdBox(q - vec3(0.0, -0.48 - explode * 0.9, 0.0), vec3(0.76, 0.10, 0.30)) - 0.02;\n  // Cut center gap so base itself is concave -> split into piece 6 (left foot) and piece 7 (right foot)!\n  float dFootL = sdBox(q - vec3(-0.52 - explode, -0.48 - explode * 0.7, 0.0), vec3(0.24, 0.09, 0.30)) - 0.02;\n  float dFootR = sdBox(q - vec3(0.52 + explode, -0.48 - explode * 0.7, 0.0), vec3(0.24, 0.09, 0.30)) - 0.02;\n  if (dFootL < res.x) res = vec2(dFootL, 6.0);\n  if (dFootR < res.x) res = vec2(dFootR, 7.0);\n  return res;\n}\n\n// Single naive outer convex hull wrapping the entire concave arch (blocks the hollow archway!)\nfloat mapOuterHull(vec3 p, float spin) {\n  vec3 q = p;\n  q.xz = rot2(spin * 0.58) * q.xz;\n  q.yz = rot2(0.32) * q.yz;\n  return sdBox(q - vec3(0.0, -0.02, 0.0), vec3(0.76, 0.56, 0.30)) - 0.03;\n}\n\nvec3 calcNormal(vec3 p, float explode, float spin) {\n  vec2 e = vec2(0.0022, 0.0);\n  return normalize(vec3(\n    mapCoACD(p + e.xyy, explode, spin).x - mapCoACD(p - e.xyy, explode, spin).x,\n    mapCoACD(p + e.yxy, explode, spin).x - mapCoACD(p - e.yxy, explode, spin).x,\n    mapCoACD(p + e.yyx, explode, spin).x - mapCoACD(p - e.yyx, explode, spin).x\n  ));\n}\n\nvec3 pieceColor(float id) {\n  if (id < 1.5) return vec3(0.18, 0.78, 0.88);\n  if (id < 2.5) return vec3(0.96, 0.52, 0.22);\n  if (id < 3.5) return vec3(0.24, 0.86, 0.54);\n  if (id < 4.5) return vec3(0.96, 0.80, 0.22);\n  if (id < 5.5) return vec3(0.72, 0.44, 0.96);\n  if (id < 6.5) return vec3(0.94, 0.34, 0.58);\n  return vec3(0.34, 0.62, 0.98);\n}\n\nvec3 aces(vec3 x) {\n  x = max(x, 0.0);\n  return (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);\n}\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n  vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;\n  float screenX = fragCoord.x / max(iResolution.x, 1.0);\n  float split = clamp(P_SPLIT, 0.0, 1.0);\n  bool isCoACD = screenX >= split;\n  float explode = isCoACD ? clamp(P_EXPLODE, 0.0, 0.38) : 0.0;\n  float hullAlpha = clamp(P_HULL_ALPHA, 0.1, 0.92);\n  float spin = iTime * max(P_ROT_SPEED, 0.0);\n\n  vec3 ro = vec3(0.0, 0.08, 2.68);\n  vec3 rd = normalize(vec3(uv, -1.55));\n\n  vec3 col = mix(vec3(0.025, 0.035, 0.056), vec3(0.068, 0.088, 0.138), smoothstep(-0.55, 0.55, uv.y));\n\n  // Trace concave mesh / CoACD convex pieces\n  float t = 0.0;\n  float matId = 0.0;\n  bool hit = false;\n  for (int i = 0; i < 64; i++) {\n    vec2 h = mapCoACD(ro + rd * t, explode, spin);\n    if (h.x < 0.002) { hit = true; matId = h.y; break; }\n    t += h.x;\n    if (t > 8.0) break;\n  }\n\n  if (hit) {\n    vec3 p = ro + rd * t;\n    vec3 n = calcNormal(p, explode, spin);\n    vec3 l1 = normalize(vec3(0.58, 0.84, 0.52));\n    vec3 l2 = normalize(vec3(-0.70, -0.25, 0.50));\n    float diff = max(dot(n, l1), 0.0) * 0.85 + max(dot(n, l2), 0.0) * 0.25;\n    float spec = pow(max(dot(n, normalize(l1 - rd)), 0.0), 46.0);\n    vec3 alb = isCoACD ? pieceColor(matId) : vec3(0.58, 0.64, 0.74);\n    col = alb * (0.28 + 0.82 * diff) + vec3(0.95) * spec * 0.45;\n  }\n\n  // On left side: overlay the single coarse convex hull wrapping & blocking the concavity!\n  if (!isCoACD) {\n    float tH = 0.0;\n    bool hitH = false;\n    for (int i = 0; i < 56; i++) {\n      float dh = mapOuterHull(ro + rd * tH, spin);\n      if (dh < 0.0025) { hitH = true; break; }\n      tH += dh;\n      if (tH > 8.0) break;\n    }\n    if (hitH) {\n      vec3 ph = ro + rd * tH;\n      vec2 e = vec2(0.003, 0.0);\n      vec3 nh = normalize(vec3(\n        mapOuterHull(ph + e.xyy, spin) - mapOuterHull(ph - e.xyy, spin),\n        mapOuterHull(ph + e.yxy, spin) - mapOuterHull(ph - e.yxy, spin),\n        mapOuterHull(ph + e.yyx, spin) - mapOuterHull(ph - e.yyx, spin)\n      ));\n      float fres = 0.25 + 0.75 * pow(1.0 - max(dot(nh, -rd), 0.0), 2.5);\n      // Concavity error volume (where hull exists in front of empty archway!) glows warning red-orange\n      bool isErrorGap = !hit || (tH < t - 0.05);\n      vec3 hullCol = isErrorGap ? vec3(0.98, 0.22, 0.24) : vec3(0.95, 0.65, 0.22);\n      float hatch = smoothstep(0.35, 0.65, sin((ph.x + ph.y) * 34.0));\n      col = mix(col, hullCol * (0.75 + 0.35 * hatch), clamp(hullAlpha * (0.45 + 0.55 * fres), 0.18, 0.85));\n    }\n  }\n\n  float sep = smoothstep(0.0035, 0.0008, abs(screenX - split));\n  col = mix(col, vec3(0.95, 0.97, 1.0), sep);\n\n  fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);\n}",
   "execution_fidelity": "conceptual-diagram",
   "proof": {
    "kind": "rendered",
    "label": "rendered 2026-11-30",
    "ok": true,
    "proof": {
     "ok": true,
     "technique": "coacd-convex-decomposition",
     "runtime": "glsl-fragment",
     "checked_at": "2026-11-30T19:53:26.000Z",
     "renderer": "Headless EGL Tesla T4/PCIe/SSE2, OpenGL 3.30 Core, 512×512, iTime=1.5",
     "stats": {
      "mean": 0.5436,
      "std": 0.2107,
      "min": 0.1853,
      "max": 0.9029
     },
     "image": "/specimens/coacd-convex-decomposition-live.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "three-mesh-bvh",
  "mesh-boolean-manifold"
 ],
 "extends": [],
 "supersedes": [],
 "combines_with": [
  {
   "id": "mesh-boolean-manifold",
   "why": "Boolean cuts split the mesh along candidate planes."
  }
 ],
 "provenance": {
  "prose": "original text written for this index (research draft, editorially reviewed)",
  "sources_verified_at": "2026-11-29T15:51:27.588Z",
  "draft": "data/drafts/geometry/coacd-convex-decomposition.json"
 },
 "solves": [
  "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"
 ],
 "authority": "Wei et al., 2022",
 "url": "https://texelatlas.vercel.app/t/coacd-convex-decomposition/",
 "execution_fidelity": "conceptual-diagram",
 "fidelity_label": "Visual Diagram",
 "benchmark_eligible": false,
 "gpu_weight": {
  "weight_x": 31.24,
  "tier": "heavy",
  "p50_ms": 0.9683,
  "p95_ms": 1.0214,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 36,
  "preset_id": "coacd-convex-decomposition-live",
  "execution_fidelity": "conceptual-diagram",
  "fidelity_label": "Visual Diagram",
  "benchmark_eligible": false,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 28.26,
   "tier": "heavy",
   "p50_ms": 0.4493,
   "p95_ms": 0.4642,
   "speedup_x": 2.16,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 19.2,
   "tier": "moderate",
   "p50_ms": 0.553,
   "p95_ms": 0.5726,
   "speedup_x": 1.75,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}