Draco mesh compression
Google's open library that compresses mesh connectivity and quantized attributes into a small stream, decoded on the CPU at load time.
Also known as Draco, KHR_draco_mesh_compression
In the family Performance, LOD & compression, mesh compression
Where it runs
Built inOfficial add-onPluginNone foundNot researched
| Engine | Support | How |
|---|---|---|
| three.js r187 | Official add-on | import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js' docs |
| Babylon.js 9.38.0 | Built in | BABYLON.DracoCompression (used automatically by glTF KHR_draco_mesh_compression) docs |
| Godot 4.7 | None found | |
| Unity | Official add-on | Package Manager > Draco for Unity (com.unity.cloud.draco) docs Official Unity package. |
| Unreal 5.7 | Official add-on | Interchange glTF Importer (glTF 2.0 / GLB mesh import & decompression) docs |
| Blender 5.2 | Official add-on | Properties on export: File > Export > glTF 2.0 > Data > Compression (Draco) docs Bundled glTF 2.0 add-on. |
| WebGPU W3C | None found | |
| Metal | None found |
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.
The 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 choose it
Reach for it when
- 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
Choose it to cut download size of static meshes and point clouds. Prefer meshoptimizer mesh optimization 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.
Field marks
- 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
Presets
Draco Mesh Compression — low-bit quantized geometry & edgebreaker facets (left) vs 14-bit decoded smooth mesh (right)
{
"P_QUANT_BITS": 5,
"P_WIRE_VIS": 0.55,
"P_ROT_SPEED": 0.5,
"P_SPLIT": 0.48
}Show GLSL (111 lines)
const float P_QUANT_BITS = 5.00; // P Position Quant Bits [3.0, 9.0, 1.0]
const float P_WIRE_VIS = 0.55; // P Edgebreaker Mesh [0.0, 1.0, 0.05]
const float P_ROT_SPEED = 0.50; // P Turntable Speed [0.0, 1.6, 0.05]
const float P_SPLIT = 0.48; // P Low-Bit / Decoded [0.0, 1.0, 0.02]
vec2 rot2(vec2 p, float a) {
float c = cos(a);
float s = sin(a);
return vec2(c * p.x - s * p.y, s * p.x + c * p.y);
}
// Sculpted organic torus-knot-like blob for exposing vertex quantization & normal oct-encoding artifacts
float mapSculpture(vec3 p, float t) {
p.xz = rot2(p.xz, t * 0.55);
p.xy = rot2(p.xy, 0.25 * sin(t * 0.4));
vec2 q = vec2(length(p.xz) - 0.36, p.y);
float torus = length(q) - 0.19;
float ribs = 0.032 * sin(atan(p.z, p.x) * 6.0 + p.y * 8.0) * cos(p.y * 10.0);
float core = length(p) - 0.26;
return min(torus + ribs, core);
}
vec3 calcNormal(vec3 p, float t) {
vec2 e = vec2(0.0025, 0.0);
return normalize(vec3(
mapSculpture(p + e.xyy, t) - mapSculpture(p - e.xyy, t),
mapSculpture(p + e.yxy, t) - mapSculpture(p - e.yxy, t),
mapSculpture(p + e.yyx, t) - mapSculpture(p - e.yyx, t)
));
}
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);
float bits = clamp(floor(P_QUANT_BITS + 0.5), 3.0, 10.0);
float wireVis = clamp(P_WIRE_VIS, 0.0, 1.0);
float t = iTime * max(P_ROT_SPEED, 0.0);
vec3 ro = vec3(0.0, 0.28, 2.05);
vec3 rd = normalize(vec3(uv.x, uv.y - 0.07, -1.48));
vec3 lDir = normalize(vec3(0.62, 0.78, 0.55));
vec3 col = mix(vec3(0.06, 0.08, 0.13), vec3(0.16, 0.22, 0.34), smoothstep(-0.4, 0.5, uv.y));
float dist = 0.05;
bool hit = false;
for (int i = 0; i < 64; i++) {
float h = mapSculpture(ro + rd * dist, t);
if (h < 0.002) { hit = true; break; }
dist += h * 0.85;
if (dist > 6.0) break;
}
if (hit) {
vec3 p = ro + rd * dist;
vec3 n = calcNormal(p, t);
// Rotate into object-local coordinates so quantization grid is rigidly locked to mesh vertices
vec3 pObj = p;
pObj.xz = rot2(pObj.xz, t * 0.55);
pObj.xy = rot2(pObj.xy, 0.25 * sin(t * 0.4));
if (screenX < split) {
// Left: Low-bit Draco spatial quantization grid + coarse octahedral normal snapping + edgebreaker strip lines
float qSteps = pow(2.0, bits) * 0.38;
vec3 pQuant = floor(pObj * qSteps + 0.5) / qSteps;
vec3 errVec = pObj - pQuant;
// Quantized faceted normal (coarse oct-encoding)
float nSteps = max(qSteps * 0.32, 2.0);
vec3 nQuant = normalize(floor(n * nSteps + 0.5) / nSteps + vec3(1e-4));
// Edgebreaker traversal triangle-strip grid in object space
vec3 cellF = fract(pObj * qSteps);
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));
float wire = smoothstep(0.08, 0.015, edgeDist);
// Color-code quantization prediction residual error magnitude
float errMag = clamp(length(errVec) * qSteps * 1.6, 0.0, 1.0);
vec3 alb = mix(vec3(0.24, 0.68, 0.88), vec3(0.98, 0.46, 0.18), errMag);
float ndl = max(dot(nQuant, lDir), 0.0);
float spec = pow(max(dot(reflect(-lDir, nQuant), -rd), 0.0), 18.0);
col = alb * (0.24 + 0.90 * ndl) + vec3(0.9, 0.95, 1.0) * spec * 0.55;
col = mix(col, vec3(0.96, 0.98, 1.0), wire * wireVis * 0.65);
} else {
// Right: High-precision 14-bit Draco-decoded smooth metallic ceramic mesh
float ndl = max(dot(n, lDir), 0.0);
float spec = pow(max(dot(reflect(-lDir, n), -rd), 0.0), 48.0);
float fres = pow(1.0 - max(dot(n, -rd), 0.0), 4.0);
vec3 alb = mix(vec3(0.22, 0.64, 0.86), vec3(0.84, 0.88, 0.94), 0.5 + 0.5 * n.y);
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;
}
} else if (rd.y < -0.005) {
float tf = (-0.52 - ro.y) / rd.y;
if (tf > 0.05 && tf < 14.0) {
vec3 fp = ro + rd * tf;
float sh = smoothstep(0.28, 0.68, length(fp.xz));
vec2 gf = abs(fract(fp.xz * 2.5) - 0.5);
float grid = smoothstep(0.04, 0.01, min(gf.x, gf.y));
vec3 fl = mix(vec3(0.11, 0.13, 0.18), vec3(0.24, 0.30, 0.40), grid) * (0.35 + 0.65 * sh);
col = mix(col, fl, exp(-tf * 0.16));
}
}
float sep = smoothstep(0.0035, 0.0008, abs(screenX - split));
col = mix(col, vec3(0.95, 0.98, 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 |
|---|---|---|---|
| draco-mesh-compression-live | Tesla T4 1920x1080 | 15.8× baseline (moderate) · 0.520 ms / 0.538 ms | opengl-timer-query · 32 frames · GPU Weight Atlas · Colab T4 sweep |
| draco-mesh-compression-live | NVIDIA L4 1920x1080 | 14.3× baseline (moderate) · 0.227 ms / 0.229 ms · 2.3× faster on L4 | opengl-timer-query · Cross-architecture validation |
| draco-mesh-compression-live | NVIDIA A100-SXM4-40GB 1920x1080 | 10.3× baseline (moderate) · 0.298 ms / 0.301 ms · 1.8× faster on A100 | opengl-timer-query · Cross-architecture validation |
Crosses
- Basis Universal / KTX2 supercompression: A compressed glTF can pair Draco geometry with KTX2 textures to cut both streams.
Sources
- primarygoogle (2016). google/draco. 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.GitHub API · license Apache-2.0 · 2026-11-29