Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Mirei3D opened this issue Dec 10, 2024 · 2 comments · May be fixed by #30091
Open

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

Mirei3D opened this issue Dec 10, 2024 · 2 comments · May be fixed by #30091
Labels

Comments

@Mirei3D
Copy link

Mirei3D commented Dec 10, 2024

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

@Mirei3D Mirei3D changed the title GLTFLoader: mesh with multiple primitives and multiple instances have non-unique name GLTFLoader: meshes with multiple primitives and multiple instances have non-unique name Dec 10, 2024
Mirei3D added a commit to Mirei3D/three.js that referenced this issue Dec 10, 2024
@mrdoob
Copy link
Owner

mrdoob commented Dec 11, 2024

The GLTF loader (to my understanding) attempts to assign unique names to all nodes it parses.

@donmccurdy Not sure that's true?

@donmccurdy
Copy link
Collaborator

donmccurdy commented Dec 11, 2024

Assigning unique names to each node has been the intention, yes. Originally this was done because animation track assignments would require it. Since then it's become necessary for R3F's gltfjsx and Threlte's gltf as well, although they might have the additional option of pre-processing the model so that names in the source file are already unique and don't require changes from three.js.

Same issue reported in:

More comments in:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants