Proposal: nodes + material lookup tables for GLTFLoader

Description of the problem

Currently when we want to change things inside a GLTF, for instance making meshes drop shadows, material props, etc, we have to do messy deep traversals.

GLTF loader already returns scenes, cameras and assets, but looking though the source it still knows about nodes and materials internally. If this could be exposed it would be very efficient for us to make changes:

new GLTFLoader().load(url, gltf => {
  gltf.materials["base"].roughness = 0.5
  gltf.nodes["plane"].castShadow = true

i have made a tool for gltf-jsx exports that does something similar, and i’ve started implementing the above variant in a test, it looks like this now:

Screenshot 2020-02-01 at 18 35 42

would it be possible to add these two collections officially to the gltf result?

Author: Fantashit

1 thought on “Proposal: nodes + material lookup tables for GLTFLoader

  1. @donmccurdy @mrdoob now that threejs dedupes names and there are no unnamed objects, could we look at this proposal again? we’ve been working with this for a long while now, as an extension, and it has proven very useful. i would prefer if this were official. again, having look-up tables removes the need for traversal once and for all.

Comments are closed.