question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GLTFLoader: availability of original node info of parsed Object3D (feature request)

See original GitHub issue

glTF handles nodes with their indices (nodeIndex or nodeId in GLTFParser). So some extension data in glTF-based file formats (e.g. bone mapping in VRM) depend on node indices.

However, it seems that objects loaded by current GLTFLoader don’t have any indices info. We can get complete node data from data.parser.json.nodes, but cannot link them with parsed objects in data.scene one to one.

I suggest adding original node info to Object3D.userData or adding an array of nodes with Object3D references to somewhere.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
reminjpcommented, Apr 2, 2019

Now, #15418 seems to be helpfull for me! I love three.js and its contributors.

1reaction
donmccurdycommented, Aug 18, 2018

I should point out that glTF nodes do not necessarily map 1:1 with three.js nodes — in this example…

  • node
    • mesh
      • primitive
  • node
    • mesh2
      • primitive1
      • primitive2
      • primitive3

… we attempt to flatten things as much as possible. The first node will result in a single THREE.Mesh, where the second may become a Group containing one or more meshes, or a single mesh, depending on whether the primitives can be merged safely. So unfortunately, even with userData, the mapping you suggest is not trivial.

Do you mind saying a bit more about how you would want to use these indices? If you ensure your objects have unique names, using node names and scene.getObjectByName(...) may be more robust. Or accessing parser.getDependency( 'node', index ) directly, combined with https://github.com/mrdoob/three.js/pull/14492, may be an option.

Read more comments on GitHub >

github_iconTop Results From Across the Web

GLTFLoader – three.js docs
A loader for glTF 2.0 resources. glTF (GL Transmission Format) is an open format specification for efficient delivery and loading of 3D content....
Read more >
Three. js and TypeScript | Sean Bradley - Skillshare
Welcome to my course on Three. js and Typescript. Three. js is a cross-browser JavaScript library and Application Programming Interface used to create...
Read more >
GLTFLoader - Babylon.js Documentation
Loads the alpha properties from a glTF material into a Babylon material. Must be called after the setting the albedo texture of the...
Read more >
Three.js Loading a .GLTF File
OBJ file format is very old and fairly simple. It provides no scene graph so everything loaded is one large mesh. It was...
Read more >
Load 3D Models in glTF Format - Discover three.js!
If these are new to you, or you need a refresher, head over to the Asynchronous JavaScript. The GLTFLoader Plugin#. To load glTF...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found