Command Palette

Search for a command to run...

Hectal
Back to the lesson: Topic 10.1 — Inside glTF
3D Web · Example 1 of 2

Read a .glb file by hand

No three.js at all: just fetch and a DataView. This is what GLTFLoader does first.

glTF is the standard file format for 3D on the web: a JSON description of the scene plus the raw bytes of its geometry and images. A .glb puts both in one binary file: a 12-byte header and two chunks.

Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.

Ready for more? This phase has 4 hands-on exercises with automatic checks.

Practice questions

Write the code in the editor, run it, then open the model answer to compare.

01

Extend the first example to print the name of every node that has a mesh.

02

Using the inspector, find how many bytes of the bike's file are the tyre texture.

Explain it without notes

01

Explain the difference between a node, a mesh and an accessor in glTF.

02

Why do web apps ship .glb rather than .gltf with embedded data?

Read a .glb file by hand

Console

(nothing was printed)

Expected console output

magic: glTF | version: 2 | total length: 1325548 bytes
chunk JSON 28296 bytes
  nodes 33 | meshes 25 | accessors 106 | materials 5 | images 1
  generator: THREE.GLTFExporter r186
chunk BIN 1297224 bytes