Command Palette

Search for a command to run...

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

.gltf or .glb: the same tube, two files

The colour comes back as 1.000, 0.147, 0.025: glTF stores colours in linear space, and that is #ff6b2c converted (Topic 5.6).

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?

.gltf or .glb: the same tube, two files
Press Run to see the page.
idle

Console

Nothing logged yet.

Expected console output

.gltf: 6060 characters of JSON
  buffer starts: data:application/octet-stream;base64,...
.glb:  4848 bytes
names kept: down-tube | material colour: 1.000, 0.147, 0.025, 1.000