GLB export doesn't include mesh names

The GLTF exporter does not include the names of the meshes when a scene or a 3D object is exported as GLB.

I recreated this by exporting a simple cube from Blender in GLTF format and exported it to GLB using the gltf-exporter (see attached files)

You can see the meshes in the GLB file do not contain the names. Any help to sort out this?

cube.gltf (4.4 KB)
cube.glb (2.7 KB)

In three.js, a THREE.Mesh is a subclass of THREE.Object3D, and so meshes appear directly in the scene graph. In glTF, meshes are resources that can be attached to any ‘node’, more like a BufferGeometry in three.js. So I think the name of your mesh has been attached to the glTF “node” and not the glTF “mesh” here — if you open the file you’ll see three named nodes: “Cube”, “Camera”, and “Light”.

Thank @donmccurdy

I will provide some background info. I tried to use GitHub - facebookincubator/glTFVariantMeld: An application that accepts files on the glTF format, interprets them as variants of an over-arching whole, and melds them together. with the Three JS exported GLB models. But it returned an error as meshes do not have names.

I assume my best approach is to add mesh names to the GLTF JSON object and convert it to GLB. I know glTFVariantMeld is out of the ThreeJS, but appreciate it if you have any suggestions.

Editing the JSON “meshes” entries should be fine. Another option would be to run a script like this in the script editor, applying the node names to the meshes:

const scene = document.getRoot().listScenes()[0];

scene.traverse((node) => {
	const name = node.getName();
	const mesh = node.getMesh();
	if (mesh && name) {

1 Like