Skip to content
← Back to Blog guide

glTF-Transform: batch-optimize GLB assets for your game pipeline

By BitSoul3D4 min read184 views

Every game project eventually accumulates a folder of GLBs nobody has audited: oversized textures, duplicate accessors, uncompressed vertex data, untrimmed animations. glTF-Transform is the CLI and Node.js library that lets you fix all of it in one automated pass — no DCC tool, no manual re-export.

glTF-Transform: batch-optimize GLB assets for your game pipeline

What glTF-Transform does — and why game pipelines need it

glTF-Transform is an open-source JavaScript library and CLI for reading, modifying, and writing glTF 2.0 and GLB files. Unlike Blender or Substance, it operates purely on the glTF document model: accessors, buffer views, meshes, materials, and extensions. That makes it lightweight, fast, and scriptable.

What glTF-Transform does — and why game pipelines need it — illustrated

The key difference from other mesh optimizers: glTF-Transform is non-destructive to source files. It reads one GLB in, writes an optimized copy out. Run it against every asset at build time and keep clean source files in version control.

Core operations it covers:

Installing and running the CLI on your asset folder

npm install -g @gltf-transform/cli
gltf-transform --version
# 4.x.x

Single-file optimization pass:

gltf-transform optimize input.glb output.glb \
  --texture-compress ktx2 \
  --texture-size 2048

Batch processing an entire folder:

for f in assets/raw/*.glb; do
  out="assets/optimized/$(basename "$f")"
  gltf-transform optimize "$f" "$out" \
    --texture-compress ktx2 \
    --texture-size 1024 \
    --draco
  echo "✓ $f → $out"
done
Tip: Always set --texture-size. Blender exports at full resolution by default — a 4096 albedo on a prop that never fills 256 px on screen is pure waste.

Key transforms every game dev should know

TransformCLI flagWhat it doesWhen to use it
Draco--dracoCompress geometry with DracoWeb and mobile targets
KTX2--texture-compress ktx2Basis Universal GPU texturesUnity, UE5, Godot 4
Dedupbuilt into optimizeRemove duplicate accessorsAll multi-mesh Blender exports
Prunebuilt into optimizeStrip unused scene dataAfter animation retargeting
Flatten--flattenCollapse node hierarchyStatic props, instanced meshes
Weld--weldMerge nearby verticesLOD generation prep
Resample--resampleDrop redundant keyframesAll rigged characters

Engine-specific notes:

Automating GLB optimization in a CI/CD pipeline

For teams on GitHub Actions or any Node-based build, glTF-Transform installs as a dev dependency and integrates before the engine build step.

npm install --save-dev @gltf-transform/core @gltf-transform/extensions @gltf-transform/functions
npm install --save-dev draco3dgltf sharp

Minimal batch optimization script (scripts/optimize-assets.mjs):

import { NodeIO } from '@gltf-transform/core';
import { ALL_EXTENSIONS } from '@gltf-transform/extensions';
import { dedup, prune, resample, textureCompress } from '@gltf-transform/functions';
import draco3d from 'draco3dgltf';
import sharp from 'sharp';
import { glob } from 'glob';
import path from 'path';

const io = new NodeIO()
  .registerExtensions(ALL_EXTENSIONS)
  .registerDependencies({
    'draco3d.encoder': await draco3d.createEncoderModule(),
    'sharp': sharp,
  });

for (const src of await glob('assets/raw/**/*.glb')) {
  const dest = src.replace('assets/raw', 'assets/optimized');
  const doc = await io.read(src);
  await doc.transform(
    dedup(),
    prune(),
    resample(),
    textureCompress({ encoder: sharp, targetFormat: 'webp', resize: [1024, 1024] }),
  );
  await io.write(dest, doc);
  console.log(`✓ ${path.basename(src)}`);
}

GitHub Actions step:

- name: Optimize GLB assets
  run: node scripts/optimize-assets.mjs

Automating GLB optimization in a CI/CD pipeline — illustrated

Structure the repo so assets/raw/ holds artist-authored files and assets/optimized/ is a generated output never committed to git. Add assets/optimized/ to .gitignore and let CI regenerate it on every build. Artists push source GLBs freely; the pipeline handles optimization on every merge.

Verify the size reduction after a run:

du -sh assets/raw/ assets/optimized/
# assets/raw/     420M
# assets/optimized/  148M

Typical reduction on a mixed prop set: 40–70%, with no visible quality loss at in-game distances.

Start with production-ready GLBs from BitSoul's marketplace and run this pipeline on download. Every asset ships in GLB format — one gltf-transform optimize pass gives you engine-ready files with compressed geometry and GPU-native textures in seconds.


This post is part of the Ultimate Guide to Free 3D Game Assets — BitSoul's complete reference for formats, texturing, rigging, optimization, and engine integration.


Need drop-in assets for this workflow? Grab the 94-model Animal Bundle on the BitSoul marketplace and drop them straight into your project.

Tags: animals

Skip the modeling — download it instead

A free BitSoul3D account gets you 2 GLB downloads every month for personal use plus 25 one-time AI Engine credits, no card required. PBR-textured GLB downloads with a full 3D preview before you buy, for Unreal, Unity, Godot or Blender — OBJ and 3D-printable STL come with any purchase or paid plan.

Browse 1,051 models — from $4.99 → or start free (2 downloads a month)