{
 "id": "draco-mesh-compression",
 "title": "Draco mesh compression",
 "aliases": [
  "Draco",
  "KHR_draco_mesh_compression"
 ],
 "domain": "performance",
 "subdomain": "mesh compression",
 "stage": "performance",
 "realtime": "realtime",
 "platforms": [
  "webgl2",
  "webgpu",
  "cpu"
 ],
 "year_introduced": 2017,
 "inputs": [
  "mesh",
  "point-cloud"
 ],
 "outputs": [
  "mesh"
 ],
 "style": "both",
 "dynamic": "static",
 "summary": "Google's open library that compresses mesh connectivity and quantized attributes into a small stream, decoded on the CPU at load time.",
 "how_it_works": "Positions, normals and UVs are quantized to a chosen number of bits. Connectivity is encoded with an edgebreaker-style traversal, and attributes are predicted from already decoded neighbours, with the small residuals entropy coded. The decoder, often WebAssembly, rebuilds vertex and index arrays that go straight into GPU buffers.\n\nThe result is much smaller than uncompressed or gzip glTF, but decoding happens on load and the vertex order may change, so it is a delivery format and not a runtime format.",
 "when_to_use": "Choose it to cut download size of static meshes and point clouds. Prefer `meshoptimizer` encoding when fast decoding and vertex-cache order matter or when animation and morph targets are present. Prefer neither for tiny meshes where decoder size outweighs saved bytes.",
 "cost": {
  "class": "medium",
  "notes": "Decoding cost sits on the CPU at load and grows with mesh size."
 },
 "failure_modes": [
  "Quantization causes visible cracks between separately compressed meshes at seams",
  "Changed vertex order hurts cache efficiency unless reoptimized",
  "Decoding stalls the main thread without a worker",
  "Weak fit for animated or morph-target data"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "gh:google/draco",
   "type": "code",
   "title": "google/draco",
   "description": "Draco is a library for compressing and decompressing 3D geometric meshes and point clouds. It is intended to improve the storage and transmission of 3D graphics.",
   "authors": [
    "google"
   ],
   "year": 2016,
   "venue": "GitHub",
   "url": "https://github.com/google/draco",
   "ids": {
    "repo": "google/draco"
   },
   "license": "Apache-2.0",
   "extra": {
    "stars": 7570,
    "stars_checked": "2026-11-29",
    "archived": false,
    "fork": false,
    "pushed_at": "2026-11-16T19:45:47Z",
    "language": "C++",
    "homepage": "https://google.github.io/draco/",
    "license_name": "Apache License 2.0"
   },
   "provenance": {
    "title": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/google/draco",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/google/draco",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/google/draco",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/google/draco",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/google/draco",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "license": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/google/draco",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": null,
   "__bib": "google2016google"
  },
  {
   "role": "primary",
   "key": "url:https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_draco_mesh_compression",
   "type": "web",
   "title": "KHR_draco_mesh_compression",
   "authors": [],
   "year": null,
   "venue": "github.com",
   "url": "https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_draco_mesh_compression",
   "ids": {},
   "license": null,
   "extra": {
    "http_status": 200,
    "live": true,
    "archive": {
     "url": "http://web.archive.org/web/20260207001745/https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_draco_mesh_compression",
     "timestamp": "20260207001745"
    },
    "page_title": "glTF/extensions/2.0/Khronos/KHR_draco_mesh_compression at main · KhronosGroup/glTF",
    "host": "github.com",
    "title_confirmed_by_page": true,
    "title_unconfirmed": false
   },
   "provenance": {
    "title": {
     "authority": "http",
     "endpoint": "GET https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_draco_mesh_compression → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "http",
     "endpoint": "GET https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_draco_mesh_compression → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "http",
     "endpoint": "GET https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_draco_mesh_compression → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 0.95,
   "__bib": "anondraco"
  }
 ],
 "presets": [
  {
   "id": "draco-mesh-compression-live",
   "title": "Draco Mesh Compression — low-bit quantized geometry & edgebreaker facets (left) vs 14-bit decoded smooth mesh (right)",
   "runtime": "glsl-fragment",
   "params": {
    "P_QUANT_BITS": 5,
    "P_WIRE_VIS": 0.55,
    "P_ROT_SPEED": 0.5,
    "P_SPLIT": 0.48
   },
   "basis": "original",
   "license_note": "MIT — written for this index.",
   "code": "const float P_QUANT_BITS = 5.00; // P Position Quant Bits [3.0, 9.0, 1.0]\nconst float P_WIRE_VIS = 0.55; // P Edgebreaker Mesh [0.0, 1.0, 0.05]\nconst float P_ROT_SPEED = 0.50; // P Turntable Speed [0.0, 1.6, 0.05]\nconst float P_SPLIT = 0.48; // P Low-Bit / Decoded [0.0, 1.0, 0.02]\n\nvec2 rot2(vec2 p, float a) {\n  float c = cos(a);\n  float s = sin(a);\n  return vec2(c * p.x - s * p.y, s * p.x + c * p.y);\n}\n\n// Sculpted organic torus-knot-like blob for exposing vertex quantization & normal oct-encoding artifacts\nfloat mapSculpture(vec3 p, float t) {\n  p.xz = rot2(p.xz, t * 0.55);\n  p.xy = rot2(p.xy, 0.25 * sin(t * 0.4));\n  vec2 q = vec2(length(p.xz) - 0.36, p.y);\n  float torus = length(q) - 0.19;\n  float ribs = 0.032 * sin(atan(p.z, p.x) * 6.0 + p.y * 8.0) * cos(p.y * 10.0);\n  float core = length(p) - 0.26;\n  return min(torus + ribs, core);\n}\n\nvec3 calcNormal(vec3 p, float t) {\n  vec2 e = vec2(0.0025, 0.0);\n  return normalize(vec3(\n    mapSculpture(p + e.xyy, t) - mapSculpture(p - e.xyy, t),\n    mapSculpture(p + e.yxy, t) - mapSculpture(p - e.yxy, t),\n    mapSculpture(p + e.yyx, t) - mapSculpture(p - e.yyx, t)\n  ));\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  float bits = clamp(floor(P_QUANT_BITS + 0.5), 3.0, 10.0);\n  float wireVis = clamp(P_WIRE_VIS, 0.0, 1.0);\n  float t = iTime * max(P_ROT_SPEED, 0.0);\n\n  vec3 ro = vec3(0.0, 0.28, 2.05);\n  vec3 rd = normalize(vec3(uv.x, uv.y - 0.07, -1.48));\n  vec3 lDir = normalize(vec3(0.62, 0.78, 0.55));\n  vec3 col = mix(vec3(0.06, 0.08, 0.13), vec3(0.16, 0.22, 0.34), smoothstep(-0.4, 0.5, uv.y));\n\n  float dist = 0.05;\n  bool hit = false;\n  for (int i = 0; i < 64; i++) {\n    float h = mapSculpture(ro + rd * dist, t);\n    if (h < 0.002) { hit = true; break; }\n    dist += h * 0.85;\n    if (dist > 6.0) break;\n  }\n\n  if (hit) {\n    vec3 p = ro + rd * dist;\n    vec3 n = calcNormal(p, t);\n    // Rotate into object-local coordinates so quantization grid is rigidly locked to mesh vertices\n    vec3 pObj = p;\n    pObj.xz = rot2(pObj.xz, t * 0.55);\n    pObj.xy = rot2(pObj.xy, 0.25 * sin(t * 0.4));\n\n    if (screenX < split) {\n      // Left: Low-bit Draco spatial quantization grid + coarse octahedral normal snapping + edgebreaker strip lines\n      float qSteps = pow(2.0, bits) * 0.38;\n      vec3 pQuant = floor(pObj * qSteps + 0.5) / qSteps;\n      vec3 errVec = pObj - pQuant;\n      // Quantized faceted normal (coarse oct-encoding)\n      float nSteps = max(qSteps * 0.32, 2.0);\n      vec3 nQuant = normalize(floor(n * nSteps + 0.5) / nSteps + vec3(1e-4));\n\n      // Edgebreaker traversal triangle-strip grid in object space\n      vec3 cellF = fract(pObj * qSteps);\n      float edgeDist = min(min(min(cellF.x, 1.0 - cellF.x), min(cellF.y, 1.0 - cellF.y)), abs(cellF.x + cellF.y - 1.0));\n      float wire = smoothstep(0.08, 0.015, edgeDist);\n      // Color-code quantization prediction residual error magnitude\n      float errMag = clamp(length(errVec) * qSteps * 1.6, 0.0, 1.0);\n      vec3 alb = mix(vec3(0.24, 0.68, 0.88), vec3(0.98, 0.46, 0.18), errMag);\n\n      float ndl = max(dot(nQuant, lDir), 0.0);\n      float spec = pow(max(dot(reflect(-lDir, nQuant), -rd), 0.0), 18.0);\n      col = alb * (0.24 + 0.90 * ndl) + vec3(0.9, 0.95, 1.0) * spec * 0.55;\n      col = mix(col, vec3(0.96, 0.98, 1.0), wire * wireVis * 0.65);\n    } else {\n      // Right: High-precision 14-bit Draco-decoded smooth metallic ceramic mesh\n      float ndl = max(dot(n, lDir), 0.0);\n      float spec = pow(max(dot(reflect(-lDir, n), -rd), 0.0), 48.0);\n      float fres = pow(1.0 - max(dot(n, -rd), 0.0), 4.0);\n      vec3 alb = mix(vec3(0.22, 0.64, 0.86), vec3(0.84, 0.88, 0.94), 0.5 + 0.5 * n.y);\n      col = alb * (0.22 + 0.92 * ndl) + vec3(1.1, 1.05, 0.98) * spec * 0.95 + vec3(0.32, 0.64, 0.96) * fres * 0.65;\n    }\n  } else if (rd.y < -0.005) {\n    float tf = (-0.52 - ro.y) / rd.y;\n    if (tf > 0.05 && tf < 14.0) {\n      vec3 fp = ro + rd * tf;\n      float sh = smoothstep(0.28, 0.68, length(fp.xz));\n      vec2 gf = abs(fract(fp.xz * 2.5) - 0.5);\n      float grid = smoothstep(0.04, 0.01, min(gf.x, gf.y));\n      vec3 fl = mix(vec3(0.11, 0.13, 0.18), vec3(0.24, 0.30, 0.40), grid) * (0.35 + 0.65 * sh);\n      col = mix(col, fl, exp(-tf * 0.16));\n    }\n  }\n\n  float sep = smoothstep(0.0035, 0.0008, abs(screenX - split));\n  col = mix(col, vec3(0.95, 0.98, 1.0), sep);\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": "draco-mesh-compression",
     "runtime": "glsl-fragment",
     "checked_at": "2026-11-30T21:07:08.000Z",
     "renderer": "Headless EGL Tesla T4/PCIe/SSE2, OpenGL 3.30 Core, 512×512, iTime=1.5",
     "stats": {
      "mean": 0.57,
      "std": 0.1518,
      "min": 0.2604,
      "max": 0.956
     },
     "image": "/specimens/draco-mesh-compression-live.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "meshoptimizer",
  "basis-universal-ktx2"
 ],
 "extends": [],
 "supersedes": [],
 "combines_with": [
  {
   "id": "basis-universal-ktx2",
   "why": "A compressed glTF can pair Draco geometry with KTX2 textures to cut both streams."
  }
 ],
 "provenance": {
  "prose": "original text written for this index (research draft, editorially reviewed)",
  "sources_verified_at": "2026-11-29T15:51:27.588Z",
  "draft": "data/drafts/performance/draco-mesh-compression.json"
 },
 "solves": [
  "mesh files are too big to download",
  "need smaller static models for the web",
  "point cloud transfer size is too large",
  "reduce geometry bandwidth with quantisation",
  "gltf models take too long to load over network"
 ],
 "authority": "google, 2016",
 "url": "https://texelatlas.vercel.app/t/draco-mesh-compression/",
 "execution_fidelity": "conceptual-diagram",
 "fidelity_label": "Visual Diagram",
 "benchmark_eligible": false,
 "gpu_weight": {
  "weight_x": 15.8,
  "tier": "moderate",
  "p50_ms": 0.5199,
  "p95_ms": 0.5385,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 32,
  "preset_id": "draco-mesh-compression-live",
  "execution_fidelity": "conceptual-diagram",
  "fidelity_label": "Visual Diagram",
  "benchmark_eligible": false,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 14.26,
   "tier": "moderate",
   "p50_ms": 0.2267,
   "p95_ms": 0.229,
   "speedup_x": 2.29,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 10.34,
   "tier": "moderate",
   "p50_ms": 0.2978,
   "p95_ms": 0.3006,
   "speedup_x": 1.75,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}