glTF Transform 4.5.1 on the DamagedHelmet sample: validate, optimize, and the size drop from 3.77 MB to 547 KB.

GLB has become a common way to deliver 3D assets for the web. Many game prototyping tools, product configurators and AR workflows support it, and it is a standard export for major 3D applications and AI tools that generate 3D models from text or images.

What usually goes wrong is not the format but the file itself: a 40 MB export with 4K textures that are never displayed close enough to justify their resolution, or a model that depends on an extension the receiving app does not support.

On Linux, you can catch both problems before the file leaves your machine with one open-source tool, glTF Transform, plus a visual check in the browser. This guide walks through that loop: inspect, validate, shrink, look.

Install glTF Transform

glTF Transform is a JavaScript library for reading and editing glTF and GLB files, and its CLI exposes most of the library as subcommands. Install it globally with npm:

bash
npm install –global @gltf-transform/[email protected]

If you would rather not install anything globally, npx @gltf-transform/[email protected] <command> or bunx @gltf-transform/[email protected] <command> runs it on demand. The examples were tested with 4.5.1; later releases may change output and defaults.

Texture commands rely on the Sharp image library; if installation fails on an unusual distribution, the Sharp installation guide lists the native dependencies it needs.

To follow along, grab a public sample such as Khronos’ DamagedHelmet, a 3.77 MB GLB with five 2048×2048 textures:

bash
curl -LO https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Assets/main/Models/DamagedHelmet/glTF-Binary/DamagedHelmet.glb

Step 1: See what is inside

Start with inspect:

bash
gltf-transform inspect DamagedHelmet.glb

The report is split into tables: overview, scenes, meshes, materials, textures and animations. Focus first on three groups of information.

  • extensionsRequired in the overview. Every extension listed here must be supported by whatever opens the file. “none” is the most portable answer.
  • vertices and size in the meshes table, which tell you whether the asset is geometry-heavy.
  • resolution and gpuSize in the textures table. For this sample, each 2048×2048 JPEG is under 1.5 MB on disk, while glTF Transform estimates a minimum GPU allocation of 22.37 MB per decoded texture; actual memory use varies by device and renderer. Download size and memory are different budgets.

Step 2: Validate against the spec

bash
gltf-transform validate DamagedHelmet.glb

This runs the official Khronos glTF Validator and groups the output into errors, warnings, infos and hints. Errors mean the file does not conform to the glTF 2.0 specification and should be fixed or re-exported before delivery. Warnings may not stop a file from loading, but review each for compatibility or rendering risks.

The helmet reports one: its material needs tangents the mesh does not provide, so viewers generate them at runtime, with slight differences between engines.

Run validation on the original export and again after every change. It is usually quick and catches specification problems introduced during processing, though not every visual issue.

Step 3: Shrink it one step at a time

Inspect and Shrink GLB Files from the Linux Terminal

You can apply optimizations individually, which makes it easy to see where the savings come from:

bash
gltf-transform resize DamagedHelmet.glb step1.glb –width 1024 –height 1024
gltf-transform webp step1.glb step2.glb
gltf-transform meshopt step2.glb step3.glb

With glTF Transform 4.5.1 in our test, the commands produced these approximate sizes:

Step What it does Output size
Original Five 2048×2048 JPEG textures 3.77 MB
resize Caps textures at 1024×1024 1.25 MB
webp Re-encodes textures as WebP 928 KB
meshopt Quantizes and Meshopt-compresses geometry, plus morph targets and animation when present 555 KB

resize treats width and height as maximum dimensions and never upscales smaller textures, so it is suitable for mixed-resolution assets, but downsampling can still soften labels, normal-map detail and transparent edges. Check the result visually.

Once you know which steps help, optimize runs the common ones in a single pass:

bash
gltf-transform optimize DamagedHelmet.glb small.glb \
  –compress meshopt –texture-compress webp –texture-size 1024 –simplify false

That produced a 547 KB file. Note the last flag: by default, optimize also simplifies meshes, removing vertices, which can surprise you on a hero asset.

In 4.5.1 it also flattens the scene graph, joins meshes, prunes unused data, instances meshes, builds palette textures and resamples animations, which can change hierarchy, names or materials. Check optimize -h and disable any step that could affect your pipeline.

Step 4: Check what the receiver will need

Compression is not free. Run inspect on the new file and look at the overview again:

bash
gltf-transform inspect small.glb

The helmet now requires EXT_meshopt_compression, EXT_texture_webp and KHR_mesh_quantization. Current Babylon.js releases load a Meshopt decoder automatically. In three.js you register one with GLTFLoader, and <model-viewer> needs its meshoptDecoderLocation set; without it, our test file failed to load.

If you do not control the receiving app, keep an uncompressed fallback and confirm its supported extensions before choosing Meshopt, Draco, WebP or KTX2. Name versions clearly, e.g. helmet-src.glb and helmet-web.glb.

Step 5: Look at it

Numbers do not tell you whether the helmet still looks like a helmet. Open both versions side by side in a browser-based GLB viewer and rotate them under the same view.

At the time of writing, Tripo’s free viewer previews Draco and Meshopt geometry, KTX2 textures and files up to 200 MB, and lists triangles, vertices, materials and textures to compare with the CLI report. Running in the browser, it works across most Linux distributions without a desktop 3D suite, though rendering can vary with browser, driver and hardware.

Look for blurred labels or fine patterns after the texture resize, and for faceting or cracks along seams after quantization. If something looks wrong, go back one step instead of tweaking the final file.

Make it a habit

The two fastest checks fit in a short shell function you can run on every export:

bash
glbcheck() {
  if [ “$#” -ne 1 ]; then echo “usage: glbcheck FILE.glb” >&2; return 2; fi
  if [ ! -f “$1” ]; then echo “glbcheck: $1: no such file” >&2; return 1; fi
  gltf-transform validate “$1” && gltf-transform inspect “$1” | grep extensionsRequired
}

validate exits with a failure status only on errors, so the && means “no errors”, not “no warnings”. Read the warnings it prints.

Run at least the validation and extension check on GLB files you did not create yourself, then use the full inspection report when reviewing geometry and texture budgets. Asset libraries and AI generators make collecting models easy, but texture sizes, polygon counts and extensions vary from file to file.

The terminal tells you what you received; the browser confirms the smaller file is still the one you meant to ship.

Willie has over 15 years of experience in Linux system administration and DevOps. After managing infrastructure for startups and enterprises alike, he founded Command Linux to share the practical knowledge he wished he had when starting out. He oversees content strategy and contributes guides on server management, automation, and security.