Repolode
donmccurdy

donmccurdy/glTF-Transform

A TypeScript/JavaScript SDK and CLI for reading, editing, optimizing and writing glTF 2.0 3D models on Node.js and the Web.

Stars
2,063
Forks
223
Open issues
82
Last commit
18 days ago

What is it?

glTF Transform reads, edits and writes 3D models in the glTF 2.0 format. It is aimed at low-level, reproducible changes to a model, such as bundling or splitting files, applying quick fixes, or optimizing an existing asset. The API handles array indices and byte offsets automatically, so developers can work with the document structure without managing binary layout by hand.

The project is split into a core SDK, an extensions package for optional glTF features, a functions package of ready-made transforms such as prune, dedup, resample, Draco and texture compression, and a CLI that applies these functions to single files or in batch. The core runs in both Node.js and browsers, so the same code can serve offline build pipelines or web applications.

The CLI exposes commands for Draco and Meshoptimizer geometry compression, WebP and KTX2/Basis Universal texture compression, and texture resizing via Sharp. A browser-based playground at gltf.report lets users try the scripting API on a loaded model.

Key features

  • 01Reads, edits and writes glTF 2.0 and GLB files with automatic index and offset management.
  • 02Runs in Node.js and in the browser with the same core API.
  • 03Provides ready-made functions such as prune, dedup, resample and Draco compression.
  • 04Offers a CLI for optimizing single files or batches, including Meshopt and WebP/KTX2 texture compression.
  • 05Supports custom transforms written against the document API.

Use cases

  • Optimizing 3D assets for a web viewer by compressing geometry and textures.
  • Batch-processing a library of glTF models in a build pipeline.
  • Bundling or splitting existing glTF files without re-authoring them in a modeling tool.
  • Building glTF models procedurally or developing custom glTF extensions.

Quick start

  1. 1

    Install the CLI globally from npm

    npm install --global @gltf-transform/cli
  2. 2

    List available CLI commands

    gltf-transform --help
  3. 3

    Optimize a model in one pass

    gltf-transform optimize input.glb output.glb --texture-compress webp

Things to know

  • The CLI requires a Node.js LTS version.
  • Some texture compression features need Node.js and the Sharp library, so they do not run in the browser.

Topics

FAQ

What is glTF-Transform?
A TypeScript/JavaScript SDK and CLI for reading, editing, optimizing and writing glTF 2.0 3D models on Node.js and the Web. glTF Transform reads, edits and writes 3D models in the glTF 2.0 format. It is aimed at low-level, reproducible changes to a model, such as bundling or splitting files, applying quick fixes, or optimizing an existing asset. The API handles array indices and byte offsets automatically, so developers can work with the document structure without managing binary layout by hand.
Is glTF-Transform free to use? What license does it have?
glTF-Transform is open source under the MIT license. Check the license terms before using it in commercial products.
Is glTF-Transform still maintained?
Actively maintained. The last commit to glTF-Transform was on Oct 20, 2026.
What can I use glTF-Transform for?
Optimizing 3D assets for a web viewer by compressing geometry and textures. Batch-processing a library of glTF models in a build pipeline. Bundling or splitting existing glTF files without re-authoring them in a modeling tool. Building glTF models procedurally or developing custom glTF extensions.
How do I install glTF-Transform?
Install the CLI globally from npm: npm install --global @gltf-transform/cli List available CLI commands: gltf-transform --help Optimize a model in one pass: gltf-transform optimize input.glb output.glb --texture-compress webp
Where can I get glTF-Transform?
The source code and installation instructions are on GitHub: https://github.com/donmccurdy/glTF-Transform

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects