Originally published at SceneCrate — glTF vs GLB for Web and Three.js Games.

Sunward Outpost 3D Scene

When preparing 3D assets for a browser game, two misconceptions cause most production surprises:

  1. Assuming multi-file .gltf and binary .glb behave the same way under strict browser Content Security Policies and asset CDNs.
  2. Treating the .glb download size on disk as a proxy for GPU texture memory (VRAM) on mobile browsers and integrated graphics.

Here is what we measured while building nine walkable CC0 1.0 Three.js test scenes and a deterministic static-prop validation pipeline.

1. Multi-file .gltf vs self-contained .glb in the browser

Both .gltf and .glb store the exact same Khronos glTF 2.0 scene graph, PBR materials, and right-handed +Y up metre coordinates. Only the container differs:

  • A .gltf file is human-readable JSON referencing external .bin geometry buffers and external .png, .jpg, or .webp image files via relative paths (or inflating JSON size by ~33% if buffers are embedded as data: base64 URIs).
  • A .glb file packs a 12-byte binary header, a padded JSON chunk, and a raw BIN chunk holding vertex buffers and compressed image bytes in one self-contained file.

Multi-file .gltf is convenient in local Git/Blender iteration when sharing one texture directory across dozens of WIP meshes. At runtime in a browser game, however, external sidecar files multiply failure modes: broken relative paths behind versioned CDNs, partial HTTP cache misses leaving half-textured meshes, and no single atomic SHA-256 hash to verify before parsing.

In our Three.js viewer, every asset must be a strictly self-contained .glb. We check the 12-byte GLB header upfront before spinning up any parser or worker:

export function isValidGlbHeader(bytes: Uint8Array, fullByteLength = bytes.byteLength): boolean { if (bytes.byteLength < 12) return false; const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength); const magic = view.getUint32(0, true); // 0x46546c67 === 'glTF' const version = view.getUint32(4, true); // glTF 2.0 const length = view.getUint32(8, true); // exact byte length return magic === 0x46546c67 && version === 2 && length === fullByteLength; } 

At runtime, our LoadingManager.setURLModifier rejects any external network URL and permits only internal blob: URLs created from the verified buffer.

Strict CSP gotcha: When GLTFLoader decodes embedded PNG/JPEG/WebP buffers inside a .glb, it creates internal blob: object URLs. If your HTTP Content-Security-Policy locks down default-src 'self', you must allow blob: in both img-src and connect-src—otherwise embedded GLB textures silently fail and render pure white in production.

2. Network bytes != GPU texture memory (VRAM)

PNG, JPEG, and WebP compression inside a .glb only shrink network transfer bytes. Unless your pipeline transcodes GPU block-compressed KTX2 (KHR_texture_basisu), standard 2D images expand into uncompressed RGBA8 pixels (4 bytes per pixel) when uploaded to WebGL:

  • 512 × 512 RGBA8 = 1 MiB base level (~1.33 MiB with mipmaps)
  • 1024 × 1024 RGBA8 = 4 MiB base level (~5.33 MiB with mipmaps)
  • 2048 × 2048 RGBA8 = 16 MiB base level (~21.3 MiB with mipmaps)
  • 4096 × 4096 RGBA8 = 64 MiB base level (~85.3 MiB with mipmaps)

Put BaseColor, Normal, Roughness/Metallic, and Occlusion maps at 4K on a single raw mesh, and one decorative prop consumes over 300 MiB of VRAM regardless of whether its .glb downloaded in 4 MB.

Even more counterintuitive: lowering pixel caps to save VRAM does not always shrink .glb file bytes on disk. Across the three static props in our CC0 reference library:

Prop Triangles (Both Tiers) Standard (1024 px cap) Lightweight (512 px cap) Base RGBA8 VRAM Change
Moss stone 80 1.31 MiB (1,373,976 B) 320.3 KiB (327,988 B) 4× lower per 1024 → 512 map
Oak barrel 1,244 113.5 KiB (116,180 B) 207.7 KiB (212,700 B) 4× lower per 1024 → 512 map
Shipping crate 12 54.2 KiB (55,452 B) 118.1 KiB (120,944 B) 4× lower per 1024 → 512 map

On high-frequency noisy textures (Moss stone), downsampling 1024 → 512 shrank compressed bytes ~4× as expected. On compact procedural textures (Oak barrel and Shipping crate), resampling introduced smooth intermediate pixel gradients that encoded into more PNG/JPEG bytes on disk—yet on a memory-constrained mobile browser, the 512 px tier still saves 75% of decoded texture memory per resized map.

3. Material counts drive WebGL draw calls in both formats

Switching from .gltf to .glb merges files on disk, not draw calls on the GPU. Every distinct material primitive in a loaded glTF scene submits a separate WebGL draw call unless your engine batches or instances them.

Compare two enterable buildings in our test library:

  • Mossgate Passage (stone-gateway) renders 105,945 triangles using just 2 baked PBR atlas materials.
  • Sunward Outpost (desert-outpost) renders 8,538 triangles across 15 distinct materials (2,136 triangles / 15 materials in Lightweight).

For individual static props placed dozens of times across a level, keep material budgets tight: our automated static-prop gates cap Standard deliveries at <= 15,000 triangles / 1024 px / 4 materials (8 MiB max) and Lightweight deliveries at <= 5,000 triangles / 512 px / 2 materials (3 MiB max).

4. Pre-ship GLB checklist for browser games

  1. Header & self-containment: Verify magic 0x46546C67, version 2, exact byte length, and zero external buffer/image URIs.
  2. Track VRAM separately from zip bytes: Audit texture pixel dimensions (width × height × 4 × 1.33) alongside HTTP download size.
  3. Metre scale & grounding: Confirm +Y up metre dimensions with the base resting at y = 0 next to a 1.7 m player capsule.
  4. Explicit collision: Pair closed convex props with a conservative box, enterable doorways with local wall boxes, and sloped ground with a shared heightfield.
  5. Clean WebGL disposal: Traverse removed hierarchies and call .dispose() on geometries, materials, and textures on level unload.

If you want to inspect the .glb buffers, report.json metrics, and runnable local Three.js harnesses directly, all nine scene packs are free to download under CC0 1.0 (no sign-in required) at SceneCrate Free 3D Game Assets, and the full guide series is at scenecrate.com/guides.