Key takeaways
- Container difference: .gltf splits JSON structure from external .bin and image files (or inflates JSON ~33% with base64 URIs), whereas .glb packs JSON, buffers, and textures into one binary file with a 12-byte header.
- Network vs GPU memory: packing PNG or JPEG images into a .glb eliminates extra HTTP requests, but decoded RGBA8 textures occupy the exact same WebGL VRAM in both formats (16 MiB base for 2048 × 2048).
- Draw-call awareness: material count drives WebGL draw calls regardless of container; Mossgate Passage draws 105,945 triangles in 2 atlas materials, while Sunward Outpost uses 15 materials across 8,538 triangles.
- Pre-ship validation: verify the 12-byte GLB header (magic 0x46546C67, version 2, exact byte length), zero external URIs, Y-up metre bounds, and SHA-256 checksums before deployment.
1. Same glTF 2.0 scene graph, different packaging
A multi-file .gltf asset consists of a human-readable JSON file referencing one or more external .bin geometry buffers and external .png, .jpg, or .webp texture files via relative paths. Embedding those buffers inside .gltf as base64 data URIs keeps a single file, but bloats payload size by roughly 33% and slows JavaScript text parsing.
A .glb file is the official binary container of glTF 2.0. It begins with a 12-byte little-endian header (magic bytes 0x46546C67 "glTF", version 2, and the exact total file byte length) followed by a binary-aligned JSON chunk and a raw BIN chunk holding vertex buffers and compressed image bytes without base64 overhead. For web deployment, CDN caching, zip downloads, and server-side processing, .glb is cleaner and safer: one fetch, no broken relative paths when moving folders, and no external URI traversal risks.
2. Why GLB download megabytes do not equal GPU VRAM
A common mistake in Three.js optimization is assuming a small .glb file guarantees a lightweight GPU footprint. Image bytes stored inside a .glb chunk remain PNG, JPEG, or WebP compressed during download, but GLTFLoader decodes standard 2D images into uncompressed RGBA8 textures in GPU memory: 512 × 512 takes 1 MiB, 1024 × 1024 takes 4 MiB, 2048 × 2048 takes 16 MiB, and 4096 × 4096 takes 64 MiB before mipmaps (~33% extra).
Conversely, lowering a texture pixel cap guarantees lower VRAM without always shrinking compressed file bytes. In SceneCrate’s real prop packs, Moss Stone (80 triangles) drops from 1.31 MiB in Standard (1024 px cap) to 320.3 KiB in Lightweight (512 px cap), while Oak Barrel (1,244 triangles) measures 113.5 KiB in Standard and 207.7 KiB in Lightweight. Publish and inspect both file bytes and pixel budgets rather than equating the two.
3. Material counts, atlases, and draw-call budgets
Neither .gltf nor .glb automatically merges materials. Every distinct material primitive in a loaded glTF scene typically produces a separate WebGL draw call per mesh instance unless your game batches them. Compare our self-authored building demos: Mossgate Passage renders 105,945 triangles using just 2 baked PBR atlas materials, whereas Cedarwatch Cabin uses 13 materials across 10,512 triangles (12 in Lightweight) and Sunward Outpost uses 15 materials across 8,538 triangles.
For individual static props placed dozens of times across a level, keep material counts tight. SceneCrate’s automated prop budgets cap Standard deliveries at 4 materials (8 MiB max GLB) and Lightweight deliveries at 2 materials (3 MiB max GLB).
4. Deterministic GLB checks before shipping
Before committing an asset to R2, a CDN, or a release zip, run automated admission checks on the binary file. SceneCrate’s upload validator checks the leading 12 bytes immediately so truncated, padded, or misnamed files fail fast before spinning up a geometry 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;
}- Verify 12-byte GLB v2 header magic (0x46546C67) and exact byte-length match.
- Confirm zero external buffer or image URIs so the file stays 100% self-contained.
- Check report.json or loader stats for triangle count, material count, and texture pixel dimensions.
- Record SHA-256 checksums (checksums.json) so build scripts detect silent asset corruption.
Frequently asked questions
Is GLB faster to load than multi-file glTF in Three.js?
Yes in typical browser deployments: GLB fetches in one binary HTTP request with zero base64 text inflation, avoiding waterfall requests for separate .bin and texture files.
When is multi-file .gltf still useful during development?
Multi-file .gltf is handy in local git/DCC authoring when diffing JSON node properties or sharing one common texture folder across dozens of source files before packing final .glb builds.
Does converting .gltf to .glb reduce WebGL GPU memory usage?
No. Switching container formats changes file packaging and HTTP requests, not decoded texture dimensions or vertex buffer counts in WebGL VRAM.
Why does SceneCrate only accept self-contained .glb uploads?
Accepting a single binary .glb up to 50 MiB prevents missing sidecar .bin/texture files, blocks server-side path or URL fetching hazards, and guarantees deterministic SHA-256 verification.