Command Palette

Search for a command to run...

Hectal
Back to the lesson: Topic 10.2 — Export Our Bike as glTF
3D Web · Example 2 of 2

What an export keeps, changes and drops

Console only. The warning line is printed by GLTFExporter itself.

GLTFExporter turns any three.js scene into a .glb or .gltf: names, positions, standard materials, textures, lights and userData survive. Custom shaders do not, and textures are re-encoded, which can make the file bigger.

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

Write a downloadGlb(object, name) function for your project that exports and downloads a .glb.

02

Export the tyre from the second example with a price in userData, load it back, and print the price from the loaded copy.

Explain it without notes

01

What happens to a mesh with a ShaderMaterial when you export it to glTF, and why?

02

Why did exporting the bike make its file bigger than the textures it was built from?

What an export keeps, changes and drops
Press Run to see the page.
idle

Console

Nothing logged yet.

Expected console output

GLTFExporter: THREE.ShaderMaterial not supported.
texture: was a 343 KiB JPEG, now image/png of 1057 KiB
userData kept as extras: {"partNumber":"LB-01-06","price":89}
custom shader node has a material: false
light kept with: KHR_lights_punctual