Originally published at SceneCrate — glTF vs GLB for Web and Three.js Games.
When preparing 3D assets for a browser game, two misconceptions cause most production surprises:
- Assuming multi-file
.gltfand binary.glbbehave the same way under strict browser Content Security Policies and asset CDNs. - Treating the
.glbdownload 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
.gltffile is human-readable JSON referencing external.bingeometry buffers and external.png,.jpg, or.webpimage files via relative paths (or inflating JSON size by ~33% if buffers are embedded asdata:base64 URIs). - A
.glbfile packs a 12-byte binary header, a padded JSON chunk, and a rawBINchunk 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
GLTFLoaderdecodes embedded PNG/JPEG/WebP buffers inside a.glb, it creates internalblob:object URLs. If your HTTPContent-Security-Policylocks downdefault-src 'self', you must allowblob:in bothimg-srcandconnect-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,136triangles /15materials 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
- Header & self-containment: Verify magic
0x46546C67, version2, exact byte length, and zero external buffer/image URIs. - Track VRAM separately from zip bytes: Audit texture pixel dimensions (
width × height × 4 × 1.33) alongside HTTP download size. - Metre scale & grounding: Confirm
+Yup metre dimensions with the base resting aty = 0next to a1.7 mplayer capsule. - Explicit collision: Pair closed convex props with a conservative box, enterable doorways with local wall boxes, and sloped ground with a shared heightfield.
- 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.

