-
-
Notifications
You must be signed in to change notification settings - Fork 152
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
Instancing lose node names #1034
Comments
Hi @enruilo1! Removing nodes is inherent to what the More complete workarounds would depend on draft/proposed glTF extensions, such as KhronosGroup/glTF#2082. |
/cc @javagl FYI! |
With the |
@enruilo1 there's no out of the box solution here, three.js does not understand How many node(s) are you instancing? If the number is <100, then I suspect getting this working may be more work than it is worth to you. The quickest method I can see would be for you to create a custom version of the glTF-Transform/packages/functions/src/instance.ts Lines 165 to 169 in c043cb2
... you'd want to add some code that creates an empty glTF-Transform/packages/functions/src/instance.ts Lines 82 to 88 in c043cb2
... you'd want to set the (integer) ID for each, and create an ordered array of the node names. That array can then be assigned to the instanced mesh or node, and it will be available in three.js as mesh.setExtras({instanceNames: [ 'name1', 'name2', 'name3', ... ]}); Then you can run your custom version of the instance() function on whatever models you need: import { NodeIO } from '@gltf-transform/core';
import { ALL_EXTENSIONS } from '@gltf-transform/extensions';
const io = new NodeIO().registerExtensions(ALL_EXTENSIONS);
const document = await io.read('path/to/model.glb');
await document.transform( customInstance() );
await io.write('path/to/model_out.glb', document); |
Hi, when i use "gltf-transform instance", node names was losed in the instancing process. I want to preserve that names because it contains guid info for each node mesh and i have so many info attached to that guid.
Is there any way to preserve that name and when i load in threejs know what guid is for specific instance?
Adjoint a gltf with several nodes with guid names
GpuInstancing_old.zip
The text was updated successfully, but these errors were encountered: