skinninggltf

glTF Skelet animation and node hierarchy. How to combine them?


Need some help with understanding of glTF spec. I wrote loader for gltf format, but without skinning animation. How to combine joints from skin and node hierarchy? No to add some node twice, and to add all of them in correct order.


Solution

  • Consider using a "pre-process" step that marks nodes as joints before traversing the node hierarchy. In three.js we do this:

    for skin in gltf.skins
      for (joint, jointIndex) in skin.joints
        gltf.nodes[jointIndex].isJoint = true
    

    Later, we traverse the node graph and instantiate each node as a Mesh, Light, Bone, or other object type. For more specific help feel free to open an issue on the glTF repository.