Blender glTF settings that matter for the web

Export a .glb with the settings that keep a rig, named attach points, and textures intact, then load it in the browser with three.js and check the node list.

A character can look right in Blender and still be wrong in the browser. The export settings decide whether the mesh, the rig, the textures, and the named attach points survive the trip into glTF. I treat those settings as part of the asset, not as a dialog I click through on the way out the door.

This is the tutorial I wish I had written down the first time I put a rigged model on the web. It is about the export and a first load in three.js, not about how to model or rig the character.

Why glTF, and why a `.glb`

glTF 2.0 is the format I export for a browser game. The three.js guidance on loading 3D models says the same thing, and for the same reason: the format is built for runtime delivery. Meshes, materials, skins, skeletons, and animations travel together.

I export a `.glb`, the binary pack, not a `.gltf` plus a `.bin` plus a folder of textures. One file is easier to version, easier to cache, and harder to deploy with a missing texture. I only split the files when a pipeline tool has a reason to touch the buffers separately.

The official exporter lives in Blender as glTF 2.0. File, Export, glTF 2.0. I turn on Remember Export Settings so the next export from that `.blend` file starts from the same place.

What I fix in the scene before I export

The exporter will not rescue a messy scene. I do this work first, then I export a known selection.

Scale should already be real-world, or at least consistent. If a character is 1.75 meters in Blender and 175 meters in the viewer, I did not forget a setting in three.js. I forgot to apply scale, or I modeled in centimeters and never said so. I apply scale with `Ctrl-A` when the armature is in rest pose, and I check the bounding box before I export.

Rotation should be applied on the meshes that need it, with the armature's rest pose left in a state I am willing to live with. glTF is +Y up. The exporter can convert that. It cannot invent a clean rest pose if the character was built leaning on a different axis and never corrected.

Named attach points stay in the file as empties or bones with stable names: a muzzle, a hand socket, a hat pivot. Game code will look those names up later. I do not leave them as `Empty.017`. I also do not parent them to a mesh that I am about to flatten.

I export a collection I can see, not the whole file. Lights, cameras, a ground plane, and a hidden high-poly sculpt do not belong in a runtime character. Selected Objects is the first checkbox I reach for.

The export settings that actually change the file

These are the controls I set on purpose. The rest I leave at the exporter defaults unless I have a reason.

**Format.** glTF Binary (`.glb`).

**Include, Selected Objects.** On. I select the armature, the skinned meshes, and the named empties. If a mesh is not parented or weighted the way I think it is, this is when I find out, because it will be missing from the file.

**Transform, +Y Up.** On. That is the glTF convention. If I turn it off so the model "looks right" in a tool that is Z-up, I have pushed the correction into every runtime that follows the standard.

**Data, Mesh, Apply Modifiers.** This is the setting I am careful with. On a static prop, I turn it on so a Mirror or a Subdivision Surface becomes real geometry. On a skinned character, I do not want the Armature modifier baked into a posed snapshot. A baked armature is a statue. I apply the mesh modifiers I need (mirror, shrinkwrap, a subdivision I am willing to pay for), then I export with the Armature modifier still doing its job as a skin. If a test export arrives in the viewer in the current pose and never moves, this is the first place I look.

**UVs, Normals, Tangents.** UVs and normals stay on. Tangents go on when I have a normal map. A normal map without tangents is a good way to get lighting that looks fine in Blender and wrong under three.js.

**Materials.** Export, not Viewport and not Placeholder. I want the Principled BSDF graph to become a glTF material, including textures. I keep the graph boring on purpose: base color, metallic, roughness, normal, emissive when I need it. Fancy Blender-only nodes will not survive. If a material depends on a procedural that has no glTF equivalent, I bake it to a texture first.

**Images.** JPEG for heavy color maps, PNG where I need a lossless alpha or a clean roughness packing. I do not turn on a WebP-only export unless I have already confirmed the loader path understands `EXT_texture_webp`. three.js can, but a leftover tool in the pipeline might not. I would rather ship a slightly larger JPEG than a texture that vanishes in one of the viewers I use to check the file.

**Armature and skinning.** Export the armature, keep the bone hierarchy, and include the skin. I do not flatten the object hierarchy if I need those named attach points to stay addressable. Flatten is for a static prop with a transform the exporter cannot decompose. It is not a default I apply to a character.

**Animation.** On, in Actions mode, when the character has actions I actually want in the game. I name the actions the way the runtime will ask for them, and I turn on Optimize Animation Size. I do not export every take in the file "just in case." Unused actions are weight, and they are also a way to ship a leftover name that some other tool will play by accident.

**Compression, Draco.** Off, unless I have a mesh that is large enough to justify it and I have already wired `DRACOLoader` on the client. A Draco file without a decoder is a file that does not load. For the characters I ship, I would rather run a careful glTF Transform pass later than turn on Draco in the Blender dialog and discover the decoder path in production.

A first load in three.js

Once the `.glb` is in the repo, the smallest honest test is to load it and print the names in the graph. If the names I cared about are missing, I go back to the exporter before I write any game code.

import { GLTFLoader } from "three/addons/loaders/GLTFLoader.js";
import { AnimationMixer, Object3D } from "three";

const loader = new GLTFLoader();

export async function loadCharacter(
  url: string,
  parent: Object3D,
): Promise<{ root: Object3D; mixer: AnimationMixer }> {
  const gltf = await loader.loadAsync(url);
  const root = gltf.scene;
  parent.add(root);

  const names: string[] = [];
  root.traverse((obj) => {
    if (obj.name) names.push(obj.name);
  });
  console.info("gltf nodes", names);

  const muzzle = root.getObjectByName("Muzzle");
  if (!muzzle) {
    throw new Error(`Expected a node named Muzzle in ${url}`);
  }

  const mixer = new AnimationMixer(root);
  const idle = gltf.animations.find((clip) => clip.name === "Idle");
  if (idle) mixer.clipAction(idle).play();

  return { root, mixer };
}

I call `mixer.update(delta)` from the same clock I use for the rest of the frame. I do not start a second `setInterval` for animation.

If I had enabled Draco, this is where I would attach a `DRACOLoader` and set its decoder path before `loadAsync`. I would also confirm that decoder path is actually served, and that it is the same version the file was compressed with.

Unit size is the other check. After the load, I look at the bounding box. If the character is a speck or a wall, I fix the export, or I apply one documented scale factor in the loader and I write it down. I do not leave a `root.scale.set(0.01, 0.01, 0.01)` in a random component with no comment.

What I do to the file after Blender

Blender's exporter is the source of truth for the rig and the names. After that, I sometimes run glTF Transform to prune unused data and pack textures more tightly. I am careful with flatten, join, and instancing flags. I have a pipeline that has to keep named pivots and empty attach nodes alive, and those flags will happily delete them in the name of a smaller file.

A smaller file that lost `Muzzle` is not a smaller file I can use. I inspect the node list after any automated pass, the same way I inspect it after the first export. If a tool cannot promise it will keep named empties, I do not give it those flags.

I also keep the export settings in the `.blend` file, and I treat a change to those settings as a reviewable change. "It looked fine in Blender" is not a useful report when the shipped `.glb` is the thing the game loads.

Failures I have already paid for

The model is a statue. The Armature modifier was applied, or the actions were not included, or the runtime is playing a clip name that does not exist. I print `gltf.animations.map((clip) => clip.name)` before I hunt in game code.

The textures are missing or the material is a flat color. The graph used a node the exporter cannot represent, or a texture path was left outside the `.glb`. I reopen the file in gltf.report or another glTF inspector and look at the material, not at the three.js scene, first.

The character lights incorrectly. Tangents were off, the color texture was tagged as linear, or the normal map was exported as sRGB. The inspector will show that faster than a guess in the shader.

The file is huge. I shipped a 4k color map for a character that is forty pixels tall on a phone, or I left a high-poly sculpt in the selection, or I exported every action in the `.blend`. The exporter will do what I asked.

The attach point is gone. The empty was not selected, or a flatten pass merged it, or I renamed it in Blender and not in the game. This is why the loader above throws when `Muzzle` is missing. A missing name should be a failed load, not a silent `undefined`.

What I would repeat

Export a `.glb`. Select only the character you mean to ship. Leave +Y up on. Be careful with Apply Modifiers on a skinned mesh. Keep named attach points, and fail the load if they disappear. Put a first three.js load in the repo that prints the graph and plays one known action. Only then start talking about lighting and post-processing.

The art can be right and the export can still be wrong. I would rather catch that in a node list than in a screenshot from a phone.

Back to Journal