Skip to content

Options for flattening node hierarchy? #1065

@donmccurdy

Description

@donmccurdy

One area with room for performance improvement: glTF results in a fairly deep node hierarchy, even for simple (single-mesh) models. For example, Box.gltf only contains a single node entry, but results in the following three.js node tree:

  • Scene (userland scene)
    • Scene (glTF scene root)
      • Object3D (root node)
        • Object3D (not obvious where this came from...)
          • Group (derived from glTF mesh entry)
            • Mesh (derived from glTF primitive entry)

I think that 2nd Object3D is not required by glTF, and may be a bug in THREE.GLTF2Loader. But the rest is derived directly from the glTF file, and could have name, extras, or transforms attached, so it's not trivial to throw any more away.

Userland code can certainly treat the glTF as a container, and pluck the Mesh out from the bottom of the tree. But ideally viewers and frameworks like A-Frame would be able to treat the glTF as a black box, and expect reasonably efficient results.

Questions for discussion, then:

  • Is it allowed/correct for a loader to discard nodes that don't have useful data attached, like this?
  • Do we want to make any allowances (implementation notes, future spec metadata) that would help enable delivering flatter node trees?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions