{"id":13455520,"url":"https://github.com/donmccurdy/glTF-Transform","last_synced_at":"2025-03-24T08:32:59.603Z","repository":{"id":38554260,"uuid":"149730090","full_name":"donmccurdy/glTF-Transform","owner":"donmccurdy","description":"glTF 2.0 SDK for JavaScript and TypeScript, on Web and Node.js.","archived":false,"fork":false,"pushed_at":"2025-03-17T18:15:14.000Z","size":23297,"stargazers_count":1542,"open_issues_count":70,"forks_count":155,"subscribers_count":29,"default_branch":"main","last_synced_at":"2025-03-20T07:49:14.275Z","etag":null,"topics":["3d","compression","glb","gltf","mesh-processing","optimization","scene-graph"],"latest_commit_sha":null,"homepage":"https://gltf-transform.dev","language":"TypeScript","has_issues":true,"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/donmccurdy.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":".github/CODE_OF_CONDUCT.md","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},"funding":{"github":["donmccurdy"]}},"created_at":"2018-09-21T07:57:34.000Z","updated_at":"2025-03-19T11:59:39.000Z","dependencies_parsed_at":"2023-02-14T00:16:29.259Z","dependency_job_id":"218aa7a2-5634-45d2-bfe4-2cc3807c3ab2","html_url":"https://github.com/donmccurdy/glTF-Transform","commit_stats":{"total_commits":1937,"total_committers":33,"mean_commits":"58.696969696969695","dds":0.5327826535880227,"last_synced_commit":"a7c1decee2b3d3b8205933fa4c0037a359f31ad1"},"previous_names":[],"tags_count":215,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donmccurdy%2FglTF-Transform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donmccurdy%2FglTF-Transform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donmccurdy%2FglTF-Transform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donmccurdy%2FglTF-Transform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/donmccurdy","download_url":"https://codeload.github.com/donmccurdy/glTF-Transform/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245235605,"owners_count":20582272,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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","compression","glb","gltf","mesh-processing","optimization","scene-graph"],"created_at":"2024-07-31T08:01:06.628Z","updated_at":"2025-03-24T08:32:59.596Z","avatar_url":"https://github.com/donmccurdy.png","language":"TypeScript","readme":"# glTF Transform\n\n[![Latest NPM release](https://img.shields.io/npm/v/@gltf-transform/core.svg)](https://www.npmjs.com/package/@gltf-transform/core)\n[![npm bundle size](https://img.shields.io/bundlephobia/minzip/@gltf-transform/core)](https://bundlephobia.com/package/@gltf-transform/core)\n[![License](https://img.shields.io/badge/license-MIT-007ec6.svg)](https://github.com/donmccurdy/glTF-Transform/blob/main/LICENSE.md)\n[![Build Status](https://github.com/donmccurdy/glTF-Transform/workflows/build/badge.svg?branch=main\u0026event=push)](https://github.com/donmccurdy/glTF-Transform/actions?query=workflow%3Abuild)\n[![Coverage](https://codecov.io/gh/donmccurdy/glTF-Transform/branch/main/graph/badge.svg?token=Z91ZYFEV09)](https://codecov.io/gh/donmccurdy/glTF-Transform)\n\n*glTF 2.0 SDK for JavaScript and TypeScript, on Web and Node.js.*\n\n## Introduction\n\n\u003c!-- NOTICE: This section is duplicated in docs/INDEX.md. Please keep them in sync. --\u003e\n\nglTF Transform supports reading, editing, and writing 3D models in glTF 2.0 format. Unlike 3D modeling tools — which are ideal for artistic changes to geometry, materials, and animation — glTF Transform provides fast, reproducible, and lossless control of the low-level details in a 3D model. The API automatically manages array indices and byte offsets, which would otherwise require careful management when editing files. These traits make it a good choice for bundling, splitting, or optimizing an existing model. It can also be used to apply quick fixes for common issues, to build a model procedurally, or to easily develop custom extensions on top of the glTF format. Because the core SDK is compatible with both Node.js and Web, glTF Transform may be used to develop offline workflows and web applications alike.\n\nPackages:\n\n- `@gltf-transform/core`: Core SDK, providing an expressive API to read, edit, and write glTF files.\n- `@gltf-transform/extensions`: [Extensions](https://gltf-transform.dev/extensions) (optional glTF features) for the Core SDK.\n- `@gltf-transform/functions`: [Functions](https://gltf-transform.dev/functions) for common glTF modifications, written using the core API.\n- `@gltf-transform/cli`: [Command-line interface (CLI)](https://gltf-transform.dev/cli) to apply functions to glTF files quickly or in batch.\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://gltf-transform.dev/media/kicker.jpg\" alt=\"Function symbol, f(📦) → 📦, where the argument and output are a box labeled 'glTF'.\" width=\"40%\"\u003e\n\u003c/p\u003e\n\n\u003ch2\u003eCommercial Use\u003c/h2\u003e\n\n\u003cp\u003e\n\t\u003cb\u003eUsing glTF Transform for a personal project?\u003c/b\u003e That's great! Sponsorship is neither expected nor required. Feel\n\tfree to share screenshots if you've made something you're excited about — I enjoy seeing those!\n\u003c/p\u003e\n\n\u003cp\u003e\n\t\u003cb\u003eUsing glTF Transform in for-profit work?\u003c/b\u003e That's wonderful! Your support is important to keep glTF Transform\n\tmaintained, independent, and open source under MIT License. Please consider a\n\t\u003ca href=\"https://store.donmccurdy.com/l/gltf-transform-pro\" target=\"_blank\"\u003esubscription\u003c/a\u003e\n\tor\n\t\u003ca href=\"https://github.com/sponsors/donmccurdy\" target=\"_blank\"\u003eGitHub sponsorship\u003c/a\u003e.\n\u003c/p\u003e\n\n\u003cp\u003e\n\t\u003ci\u003e\n\t\tLearn more in the\n\t\t\u003ca href=\"https://store.donmccurdy.com/l/gltf-transform-pro\" target=\"_blank\"\u003e glTF Transform Pro \u003c/a\u003e FAQs\u003c/i\n\t\u003e.\n\u003c/p\u003e\n\n## Scripting API\n\nInstall the scripting packages:\n\n```bash\nnpm install --save @gltf-transform/core @gltf-transform/extensions @gltf-transform/functions\n```\n\nRead and write glTF scenes with platform I/O utilities [WebIO](https://gltf-transform.dev/modules/core/classes/WebIO), [NodeIO](https://gltf-transform.dev/modules/core/classes/NodeIO), or [DenoIO](https://gltf-transform.dev/modules/core/classes/DenoIO):\n\n```typescript\nimport { Document, NodeIO } from '@gltf-transform/core';\nimport { ALL_EXTENSIONS } from '@gltf-transform/extensions';\nimport draco3d from 'draco3dgltf';\n\n// Configure I/O.\nconst io = new NodeIO()\n    .registerExtensions(ALL_EXTENSIONS)\n    .registerDependencies({\n        'draco3d.decoder': await draco3d.createDecoderModule(), // Optional.\n        'draco3d.encoder': await draco3d.createEncoderModule(), // Optional.\n    });\n\n// Read from URL.\nconst document = await io.read('path/to/model.glb');\n\n// Write to byte array (Uint8Array).\nconst glb = await io.writeBinary(document);\n```\n\nTo perform changes to an existing glTF [Document](https://gltf-transform.dev/modules/core/classes/Document), import off-the-shelf scripts from the [Functions](https://gltf-transform.dev/functions) package, or write your own using API classes like [Material](https://gltf-transform.dev/modules/core/classes/Material), [Primitive](https://gltf-transform.dev/modules/core/classes/Primitive), and [Texture](https://gltf-transform.dev/modules/core/classes/Texture).\n\n```typescript\nimport { resample, prune, dedup, draco, textureCompress } from '@gltf-transform/functions';\nimport sharp from 'sharp'; // Node.js only.\n\nawait document.transform(\n    // Losslessly resample animation frames.\n    resample(),\n    // Remove unused nodes, textures, or other data.\n    prune(),\n    // Remove duplicate vertex or texture data, if any.\n    dedup(),\n    // Compress mesh geometry with Draco.\n    draco(),\n    // Convert textures to WebP (Requires glTF Transform v3 and Node.js).\n    textureCompress({\n        encoder: sharp,\n        targetFormat: 'webp',\n        resize: [1024, 2024],\n    }),\n    // Custom transform.\n    backfaceCulling({cull: true}),\n);\n\n// Custom transform: enable/disable backface culling.\nfunction backfaceCulling(options) {\n    return (document) =\u003e {\n        for (const material of document.getRoot().listMaterials()) {\n            material.setDoubleSided(!options.cull);\n        }\n    };\n}\n```\n\nTo learn how glTF Transform works, and the architecture of the scripting API, start with [Concepts](https://gltf-transform.dev/concepts). To try out the scripting API without installing anything, visit [gltf.report/](https://gltf.report/), load a glTF model, and open the *Script* tab.\n\n## Command-line API\n\nInstall the CLI, supported in Node.js LTS versions.\n\n```bash\nnpm install --global @gltf-transform/cli\n```\n\nList available CLI commands:\n\n```bash\ngltf-transform --help\n```\n\nOptimize everything all at once:\n\n```bash\ngltf-transform optimize input.glb output.glb --texture-compress webp\n```\n\nOr pick and choose your optimizations, building a custom pipeline.\n\nCompress mesh geometry with [Draco](https://github.com/google/draco) or [Meshoptimizer](https://meshoptimizer.org/):\n\n```bash\n# Draco (compresses geometry).\ngltf-transform draco input.glb output.glb --method edgebreaker\n\n# Meshopt (compresses geometry, morph targets, and keyframe animation).\ngltf-transform meshopt input.glb output.glb --level medium\n```\n\nResize and compress textures with [Sharp](https://sharp.pixelplumbing.com/), or improve VRAM usage and performance with KTX2 and [Basis Universal](https://github.com/BinomialLLC/basis_universal):\n\n```bash\n# Resize textures.\ngltf-transform resize input.glb output.glb --width 1024 --height 1024\n\n# Compress textures with WebP.\ngltf-transform webp input.glb output.glb --slots \"baseColor\"\n\n# Compress textures with KTX2 + Basis Universal codecs, UASTC and ETC1S.\ngltf-transform uastc input.glb output1.glb \\\n    --slots \"{normalTexture,occlusionTexture,metallicRoughnessTexture}\" \\\n    --level 4 --rdo --rdo-lambda 4 --zstd 18 --verbose\ngltf-transform etc1s output1.glb output2.glb --quality 255 --verbose\n```\n\n... [and much more](https://gltf-transform.dev/cli).\n\n## Credits\n\nSee [*Credits*](https://gltf-transform.dev/credits).\n\n## License\n\nCopyright 2024, MIT License.\n","funding_links":["https://github.com/sponsors/donmccurdy"],"categories":["TypeScript","Data Processing","Features"],"sub_categories":["3D Model Converting","A typical use-case"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdonmccurdy%2FglTF-Transform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdonmccurdy%2FglTF-Transform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdonmccurdy%2FglTF-Transform/lists"}