Guide · 3D for the web · November 2026
How to optimize GLB files for web games.
A 3D model straight out of a generator or Blender is often ten times bigger than it needs to be. On the web every megabyte is loading time, and loading time is lost players. Here is what makes GLB files heavy and how to fix each part.
- Draco & Meshopt
- KTX2 textures
- Fewer triangles
- Free tools
How do you optimize a GLB file for the web?
Shrink the textures first: resize them to 1024 or 2048 pixels and convert them to KTX2 or WebP. Then reduce triangles to what the model's role needs and compress the geometry with Meshopt or Draco. Remove unused nodes, materials and animations. Most models lose most of their size with no visible change.
Where the megabytes are
| Part | Typical problem | Fix |
|---|---|---|
| Textures | 4096 px PNGs, several per material | Resize to 1024–2048, convert to KTX2 or WebP |
| Geometry | Hundreds of thousands of triangles | Decimate, then Meshopt or Draco compression |
| Materials | Many materials, each a draw call | Merge into one atlas where you can |
| Animations | Unused clips, a key on every frame | Delete unused clips, resample and compress keys |
| Leftovers | Hidden objects, empty nodes, unused data | Prune and deduplicate |
Optimize a GLB step by step
Inspect it
Open the file in our GLB viewer to see triangles, textures, materials and animations before you change anything.
Shrink the textures
Resize to the size the model is seen at, then convert with the KTX2 texture compressor. KTX2 stays compressed on the GPU, saving memory as well as download size.
Reduce triangles
Props under 5k triangles, a main mobile character 10–30k. Decimate in Blender or with the simplify option of the GLB compressor.
Compress the geometry
Meshopt decodes very fast and also compresses animation; Draco often gives the smallest meshes. Both are glTF extensions that three.js, Babylon.js and PlayCanvas load.
Prune and test
Remove unused nodes and materials, then load the result on a phone and compare it side by side with the original.
Draco or Meshopt?
- Smallest meshes
Draco
Strong compression for static meshes. Decoding takes a bit more time and needs the Draco decoder loaded alongside your engine.
- Fastest load
Meshopt
Very fast decoding, works on morph targets and animation too, and compresses well with gzip or Brotli on the server.
- Textures
KTX2 (Basis Universal)
For textures, not geometry. Stays compressed in GPU memory, which matters on phones with little RAM.
From the command line
glTF-Transform is an open-source command-line tool that does all of the above in one pass:
npx @gltf-transform/cli optimize input.glb output.glb \
--compress meshopt --texture-compress ktx2 --texture-size 2048Web-ready GLB checklist
- Total file under a few megabytes for a main model, far less for props
- Textures 2048 px or smaller, in KTX2 or WebP
- Triangle count fits the model's role and screen size
- One or few materials
- Geometry compressed with Meshopt or Draco
- Only the animations the game uses
- Real-world scale and the origin at the feet or base
- Tested on a mid-range phone, not only on a desktop
Budgets: how big should a web game model be?
There is no single right number, but these ranges keep a browser game loading fast on mid-range phones. Use them as starting budgets and adjust after testing.
| Asset | Triangles | Textures | File size target |
|---|---|---|---|
| Small prop (crate, coin, plant) | 100 – 2,000 | One 512 px set or an atlas share | Under 100 KB |
| Medium prop (car, tree, furniture) | 2,000 – 10,000 | One 1024 px set | 100 – 500 KB |
| Main character, mobile | 10,000 – 30,000 | One 1024–2048 px set | 0.5 – 2 MB with animations |
| Main character, desktop | 30,000 – 80,000 | 2048 px set | 1 – 4 MB |
| Environment piece / level chunk | 5,000 – 50,000 | Shared atlas or tiling textures | 0.5 – 3 MB |
| Whole first-load scene, mobile | Under ~200,000 visible | Under ~64 MB GPU memory | Under ~5–10 MB download |
A texture set means base colour plus normal and roughness/metal maps. Each extra map multiplies memory, so drop the ones that don't change the look at play distance.
Why textures matter more than triangles
File size is only half of the story; GPU memory is the other half, and it is where phones run out first. A PNG or JPEG is small on disk because it is compressed, but the GPU cannot read those formats. The browser unpacks each one to raw pixels: a 2048 × 2048 texture becomes 2048 × 2048 × 4 bytes = 16 MB, plus about a third more for mipmaps, roughly 21 MB. Four such maps on one model is over 80 MB of video memory.
KTX2 with Basis Universal solves this because it is transcoded to a format the GPU reads compressed. The same 2048 texture typically takes 4 to 8 times less GPU memory. Halving the resolution to 1024 cuts memory by four again. That is why resizing and KTX2 together often matter more than any amount of polygon reduction.
Triangles still count, mostly for draw time on weak GPUs and for the size of the geometry data. But a 20,000-triangle character with one 1024 KTX2 texture will usually load and run better than a 5,000-triangle one with four 4K PNGs.
A worked example: an AI-generated character
A typical untouched model from an AI 3D generator, and what each step did to it. The numbers are representative of the kind of savings people see; your models will differ.
| Step | Triangles | Textures | File size |
|---|---|---|---|
| Original from the generator | 480,000 | 4 × 4096 px PNG | 62 MB |
| Resize textures to 1024 px | 480,000 | 4 × 1024 px PNG | 17 MB |
| Drop the unneeded maps (keep base colour + normal) | 480,000 | 2 × 1024 px PNG | 14 MB |
| Decimate to fit the mobile budget | 25,000 | 2 × 1024 px PNG | 4.1 MB |
| Convert textures to KTX2 | 25,000 | 2 × 1024 px KTX2 | 1.6 MB |
| Meshopt geometry compression + prune | 25,000 | 2 × 1024 px KTX2 | 0.9 MB |
Most of the saving came from textures and from triangles the camera never sees. Compression was the last, smaller step, which is the usual order of impact.
Reducing triangles in Blender without wrecking the model
Import and check
File → Import → glTF 2.0. Turn on Statistics in the viewport overlays to see the triangle count.
Add a Decimate modifier
Select the mesh → Modifiers → Generate → Decimate → Collapse. Lower the Ratio (0.1 keeps 10% of the faces) while watching the silhouette.
Protect what matters
Faces, hands and edges of the silhouette show damage first. Use a vertex group with the modifier to decimate the body more than the face.
Check UVs and normals
Look for stretched textures and dark patches. If shading looks faceted, set Shade Auto Smooth or bake a normal map from the original.
Apply and export
Apply the modifier, then File → Export → glTF 2.0 (.glb). Untick what you don't need: cameras, lights, unused animations.
Compress in the browser
Drop the export into the GLB compressor for smaller WebP textures, welded vertices and fewer triangles.
glTF-Transform recipes for common jobs
Single commands for specific problems, so you can apply only what a model needs:
# Inspect: triangles, textures, sizes per part
npx @gltf-transform/cli inspect model.glb
# Resize every texture to at most 1024 px
npx @gltf-transform/cli resize model.glb out.glb --width 1024 --height 1024
# Textures to KTX2 (ETC1S: smallest; UASTC: higher quality, use for normal maps)
npx @gltf-transform/cli etc1s model.glb out.glb
npx @gltf-transform/cli uastc model.glb out.glb --slots "normalTexture"
# Simplify to about 25% of the triangles, within an error bound
npx @gltf-transform/cli simplify model.glb out.glb --ratio 0.25 --error 0.001
# Remove unused data, merge duplicates, compress geometry
npx @gltf-transform/cli prune model.glb out.glb
npx @gltf-transform/cli dedup out.glb out.glb
npx @gltf-transform/cli meshopt out.glb out.glbLoading compressed GLB files in three.js
Compressed files need their decoders registered on the loader. Without them the model fails to load with an extension error.
import { GLTFLoader } from "three/addons/loaders/GLTFLoader.js";
import { DRACOLoader } from "three/addons/loaders/DRACOLoader.js";
import { KTX2Loader } from "three/addons/loaders/KTX2Loader.js";
import { MeshoptDecoder } from "three/addons/libs/meshopt_decoder.module.js";
const draco = new DRACOLoader().setDecoderPath("/decoders/draco/");
const ktx2 = new KTX2Loader().setTranscoderPath("/decoders/basis/").detectSupport(renderer);
const loader = new GLTFLoader()
.setDRACOLoader(draco)
.setKTX2Loader(ktx2)
.setMeshoptDecoder(MeshoptDecoder);
const gltf = await loader.loadAsync("/models/fox.glb");
scene.add(gltf.scene);Problems after optimizing, and their fixes
| Problem | Cause | Fix |
|---|---|---|
| Textures look blurry | Resized too far for how close the camera gets | Go up one size (1024 → 2048) for that model only |
| Normal map looks blocky or wrong | ETC1S compression on a normal map | Use UASTC for normal maps, ETC1S for colour |
| Cracks or holes in the mesh | Too aggressive simplify, or quantization too low | Raise the ratio or the error bound; check thin parts |
| Model loads in the viewer, fails in the game | Decoder not registered in the engine | Set up the Draco, Meshopt and KTX2 decoders on the loader |
| Animation jitters or slides | Keyframes resampled or quantized too hard | Use lighter animation compression or keep original keys |
| Model is huge or tiny in the scene | Exported in centimetres, or scale not applied | Apply scale in Blender, export in metres |
GLB, glTF, FBX, OBJ, USDZ: which format for the web?
| Format | What it is | Web use |
|---|---|---|
| GLB | Binary glTF: mesh, materials, textures and animations in one file | The best choice for web games |
| glTF (.gltf + .bin + images) | The same data split into a JSON file and separate files | Fine; GLB is easier to move around |
| FBX | A common format from desktop 3D tools and engines | Convert to GLB first; browsers don't load it well |
| OBJ | Old, simple format: geometry and basic materials, no animation | Only for simple static models; convert to GLB |
| USDZ | Apple's format for AR Quick Look | For AR previews on Apple devices, not for games |
Got an FBX? Convert it in the browser with [FBX to GLB](/tools/fbx-to-glb), then optimize the GLB.
Beyond the file: LOD, instancing and lazy loading
Levels of detail (LOD). A tree 50 metres away does not need 8,000 triangles. Export two or three versions of heavy models (full, half, a quarter) and let the engine swap them by distance. three.js has an LOD object for this; Babylon.js supports LOD per mesh.
Instancing. A forest of 500 copies of the same tree should be drawn as one instanced mesh, not 500 separate objects. That cuts draw calls dramatically, which matters more on phones than raw triangle counts.
Lazy loading. Load what the first screen needs, start the game, then load the next level's models in the background. A three-second start with more loading later beats a twenty-second blank screen, and most players never notice the background loads.
Serve models fast
- Serve GLB files with Brotli or gzip compression; Meshopt-compressed data shrinks further this way.
- Set long cache headers on model files and change the filename when the model changes.
- Host decoders (Draco, Basis) on the same domain or a fast CDN so they load in parallel with the model.
- Preload the first model the player sees with a link rel="preload" hint.
- Show a progress bar based on bytes loaded so a slow connection doesn't look like a crash.
Frequently asked questions
How much can a GLB file be compressed?
It depends on the model, but generated and scanned models often shrink to a fraction of their size, mostly from resizing textures and reducing triangles. Geometry compression then cuts the mesh data further.
Does Draco compression lose quality?
Draco quantizes positions and other data, which is lossy but usually invisible at sensible settings. Check thin details and UV seams after compressing.
Is KTX2 better than PNG or JPEG for games?
For the GPU, yes: KTX2 textures stay compressed in video memory, while PNG and JPEG are unpacked to full size. That saves memory and often loading time.
Can I compress a GLB without installing anything?
Yes. Our free GLB compressor runs in your browser: drop a file, choose the settings, download the smaller GLB. Nothing is uploaded.
Do three.js and Babylon.js load compressed GLB files?
Yes. Both load Draco, Meshopt and KTX2 through their glTF loaders, once the matching decoder is set up.
Should I use Draco and Meshopt together?
No, pick one per file. Meshopt is usually the better default for games because it decodes fast and also handles animation; Draco can give smaller static meshes when download size is the only concern.
What texture size should I use for a mobile game?
Start at 1024 px for main models and 512 px or an atlas for props. Go to 2048 only for something the camera shows large and close, and check GPU memory on a real phone.
Does optimizing remove animations?
Only if you ask it to. Pruning removes unused data; animation clips stay unless you delete them. Check each clip after compression for jitter.
Why is my GLB still large after Draco compression?
Draco compresses geometry only. If the file is still big, textures are the cause: resize them and convert them to KTX2 or WebP.
What is a good total download size for a web game?
Aim for a first load of a few megabytes so the game starts in seconds on mobile data, then load further levels and assets in the background as the player progresses.
EvonX AI game maker
Got the asset? Now make the game.
Describe your game in one sentence and EvonX builds it: code, art, sound and a link you can share. Free to start, no download, plays on any phone.