Skip to content

GLTFLoader: meshes with multiple primitives and multiple instances have non-unique name #30090

Open
@Mirei3D

Description

@Mirei3D

Description

The GLTF loader (to my understanding) attempts to assign unique names to all nodes it parses.
However I noticed that duplicated names can appear in meshes created for nodes in certain cases. When a GLTF mesh has multiple primitives the GLTF loader will create one THREE.Mesh per mesh primitive under a THREE.Group. When instantiating this GLTF mesh multiple times, the THREE.Group seems to usually receive a unique name, but the meshes under the group have the same names in each instance.

This can be problematic in software that manipulates parts of 3D scenes based on mesh names (e.g. user selected mesh names).

I'm not sure what the intended behaviour from the THREE.js maintainers here is, so apologies if this should have been a feature request.

Reproduction steps

  1. Open https://threejs.org/editor/
  2. Import this GLB test file: MultiInstanceMultiPrimitiveCube.glb.zip
  3. Inspect the scene hierarchy, particularly the mesh names under Cube and Cube001

Code

// code goes here

Live example

Screenshots

Bildschirmfoto 2024-12-10 um 15 25 12

Version

r171

Device

No response

Browser

No response

OS

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions