EvonX

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

By the EvonX team · Updated · 8 min read

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

What makes a GLB heavy
PartTypical problemFix
Textures4096 px PNGs, several per materialResize to 1024–2048, convert to KTX2 or WebP
GeometryHundreds of thousands of trianglesDecimate, then Meshopt or Draco compression
MaterialsMany materials, each a draw callMerge into one atlas where you can
AnimationsUnused clips, a key on every frameDelete unused clips, resample and compress keys
LeftoversHidden objects, empty nodes, unused dataPrune and deduplicate

Optimize a GLB step by step

  1. Inspect it

    Open the file in our GLB viewer to see triangles, textures, materials and animations before you change anything.

  2. 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.

  3. Reduce triangles

    Props under 5k triangles, a main mobile character 10–30k. Decimate in Blender or with the simplify option of the GLB compressor.

  4. 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.

  5. 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 2048
Prefer the browser? Our free GLB compressor runs on your machine, no upload.

Web-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.

Starting budgets for web game assets
AssetTrianglesTexturesFile size target
Small prop (crate, coin, plant)100 – 2,000One 512 px set or an atlas shareUnder 100 KB
Medium prop (car, tree, furniture)2,000 – 10,000One 1024 px set100 – 500 KB
Main character, mobile10,000 – 30,000One 1024–2048 px set0.5 – 2 MB with animations
Main character, desktop30,000 – 80,0002048 px set1 – 4 MB
Environment piece / level chunk5,000 – 50,000Shared atlas or tiling textures0.5 – 3 MB
Whole first-load scene, mobileUnder ~200,000 visibleUnder ~64 MB GPU memoryUnder ~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.

Optimisation steps on one character model
StepTrianglesTexturesFile size
Original from the generator480,0004 × 4096 px PNG62 MB
Resize textures to 1024 px480,0004 × 1024 px PNG17 MB
Drop the unneeded maps (keep base colour + normal)480,0002 × 1024 px PNG14 MB
Decimate to fit the mobile budget25,0002 × 1024 px PNG4.1 MB
Convert textures to KTX225,0002 × 1024 px KTX21.6 MB
Meshopt geometry compression + prune25,0002 × 1024 px KTX20.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

  1. Import and check

    File → Import → glTF 2.0. Turn on Statistics in the viewport overlays to see the triangle count.

  2. 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.

  3. 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.

  4. 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.

  5. Apply and export

    Apply the modifier, then File → Export → glTF 2.0 (.glb). Untick what you don't need: cameras, lights, unused animations.

  6. 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.glb
The KTX2 commands need the KTX-Software tools installed; the browser-based compressor needs nothing.

Loading 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);
Copy the decoder files from three's examples folder to your site and serve them from the paths above.

Problems after optimizing, and their fixes

Common side effects of GLB optimisation
ProblemCauseFix
Textures look blurryResized too far for how close the camera getsGo up one size (1024 → 2048) for that model only
Normal map looks blocky or wrongETC1S compression on a normal mapUse UASTC for normal maps, ETC1S for colour
Cracks or holes in the meshToo aggressive simplify, or quantization too lowRaise the ratio or the error bound; check thin parts
Model loads in the viewer, fails in the gameDecoder not registered in the engineSet up the Draco, Meshopt and KTX2 decoders on the loader
Animation jitters or slidesKeyframes resampled or quantized too hardUse lighter animation compression or keep original keys
Model is huge or tiny in the sceneExported in centimetres, or scale not appliedApply scale in Blender, export in metres

GLB, glTF, FBX, OBJ, USDZ: which format for the web?

3D formats compared for web games
FormatWhat it isWeb use
GLBBinary glTF: mesh, materials, textures and animations in one fileThe best choice for web games
glTF (.gltf + .bin + images)The same data split into a JSON file and separate filesFine; GLB is easier to move around
FBXA common format from desktop 3D tools and enginesConvert to GLB first; browsers don't load it well
OBJOld, simple format: geometry and basic materials, no animationOnly for simple static models; convert to GLB
USDZApple's format for AR Quick LookFor 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.

Free to start · Earn money from your games
Try one