{"id":50541945,"url":"https://github.com/mrdoob/draco.js","last_synced_at":"2026-06-10T03:00:38.926Z","repository":{"id":362254483,"uuid":"1258064737","full_name":"mrdoob/draco.js","owner":"mrdoob","description":"A small, drop-in, pure-JavaScript Draco mesh loader for three.js.","archived":false,"fork":false,"pushed_at":"2026-06-08T00:44:03.000Z","size":34236,"stargazers_count":164,"open_issues_count":1,"forks_count":9,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-06-09T02:26:26.359Z","etag":null,"topics":["3d","draco","geometry","gltf","loader","mesh-compression","threejs","webgl"],"latest_commit_sha":null,"homepage":"https://mrdoob.github.io/draco.js/","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrdoob.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-03T08:44:06.000Z","updated_at":"2026-06-08T04:02:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"183f4146-b9bc-4d9d-a3e9-0a5214d2c03c","html_url":"https://github.com/mrdoob/draco.js","commit_stats":null,"previous_names":["mrdoob/draco.js"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mrdoob/draco.js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrdoob%2Fdraco.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrdoob%2Fdraco.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrdoob%2Fdraco.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrdoob%2Fdraco.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrdoob","download_url":"https://codeload.github.com/mrdoob/draco.js/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrdoob%2Fdraco.js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34134633,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["3d","draco","geometry","gltf","loader","mesh-compression","threejs","webgl"],"created_at":"2026-06-03T21:00:21.005Z","updated_at":"2026-06-10T03:00:38.882Z","avatar_url":"https://github.com/mrdoob.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Draco.js\n\nA pure-JavaScript [Draco](https://github.com/google/draco) mesh **loader** for\nthree.js. It's a drop-in `DRACOLoader` that decodes Draco-compressed triangle\nmeshes — both the EdgeBreaker connectivity used by glTF's\n`KHR_draco_mesh_compression` and Draco's sequential connectivity — directly in\nJavaScript.\n\n**[Live demo →](https://mrdoob.github.io/draco.js/)**\n\nWhy a JS port instead of the official WASM build?\n\n- **Small** — ~22 KB gzipped (69 KB minified), vs ~100 KB gzipped for the\n  `draco3d` WASM decoder + glue (~4.6× smaller).\n- **Simple to ship** — one ES module. No `.wasm` fetch, no worker/glue setup,\n  no cross-origin or CSP headaches.\n- **Fast** — on substantial meshes it's within ~1.0–1.4× of the WASM decoder,\n  and effectively at parity on the largest ones, with byte-for-byte identical\n  output (see [Correctness](#correctness)).\n\nOn the largest meshes (e.g. a 358k-face glTF) the two are about even; WASM keeps\na lead of up to ~1.35× on smaller and mid-size meshes. You trade, at most, a\nmodest amount of decode speed for a much smaller, simpler-to-deploy loader.\n\nThis trade pays off most on spotty mobile connections, where transferring\n~100 KB takes much longer than ~20 KB. Even when JS parsing is slower than WASM,\nthe model often **displays sooner** end-to-end: the network savings outweigh the\nextra decode time.\n\n## Status\n\nTargets **Draco bitstream version 2.2** — what current Draco encoders and glTF\nexporters produce.\n\nNot implemented:\n\n- **Point-cloud decoding** (sequential and KD-tree) — only triangle meshes are\n  decoded.\n- **Metadata content** — geometry metadata is parsed (so metadata-bearing files\n  still decode correctly) but is not surfaced on the returned geometry.\n- **Older bitstreams** (\u003c 2.2) — not a support goal, though many still decode.\n\n## Usage\n\n`DRACOLoader` is a drop-in replacement for three.js's own `DRACOLoader` — plug it\ninto `GLTFLoader` the usual way. There's no decoder path or WASM to configure\n(`setDecoderPath` / `setDecoderConfig` are accepted but do nothing).\n\n```js\nimport { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';\nimport { DRACOLoader } from './build/DRACOLoader.js';\n\nconst gltfLoader = new GLTFLoader();\ngltfLoader.setDRACOLoader( new DRACOLoader() );\n\ngltfLoader.load( 'model.glb', ( gltf ) =\u003e scene.add( gltf.scene ) );\n```\n\nIt can also load standalone `.drc` files:\n\n```js\nconst geometry = await new DRACOLoader().loadAsync( 'model.drc' ); // BufferGeometry\n```\n\n## Build\n\n`npm run build` bundles `src/DRACOLoader.js` (via Rollup) into `build/DRACOLoader.js`\n(readable ESM) and `build/DRACOLoader.min.js` (minified), with `three` kept\nexternal. Prebuilt copies are checked in.\n\n## Correctness\n\nOutput is **byte-for-byte identical** to Google's reference `draco3d` WASM\ndecoder. `npm run verify` decodes every sample with both and compares\nelement-by-element — face indices and every per-point attribute value match\nexactly (`eps 0`) across all 260 test primitives. `npm run bench` separately\ntimes decoding and guards against output regressions via a sha256 of the\ndecoded geometry.\n\n## Project layout\n\n```\nsrc/          decoder source, mirroring draco/src/draco/ file-for-file\nbuild/        bundled output (build/DRACOLoader.js + .min.js)\ntools/        bench.mjs (timing + regression) and verify-wasm.mjs (WASM parity)\nlibs/         three.js's WASM Draco loader, vendored for the comparison\nsamples/      .drc and Draco-compressed .glb test models\nindex.html    JS-vs-WASM comparison viewer\n```\n\n## Credits\n\n- Decoder logic is a port of [Google Draco](https://github.com/google/draco)\n  (Apache-2.0); it mirrors the original C++ file structure.\n- `DRACOLoader.js` follows the API of three.js's\n  [`DRACOLoader`](https://github.com/mrdoob/three.js/blob/dev/examples/jsm/loaders/DRACOLoader.js)\n  (MIT) so it drops into `GLTFLoader` unchanged.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrdoob%2Fdraco.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrdoob%2Fdraco.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrdoob%2Fdraco.js/lists"}