Skin/Joints array vs. InvBindPose vs. Matrix List to Shader

Hello all…this is my first post so please forgive me if this is teh wrong place or already answered.

So I’ve been attempting to implement my own GLTF importer and animation rendering. I am having limited success and some things work and others look like the alien from the 80s Thing movie. I am suspecting that maybe I am missing a relationship between the Skin Joints array, the Node array and its indexes and the matrix array to the shader and the placement of matrices per index in that array. That was a long sentence so let me try to decompose. This will also refer to the RiggedSimple sample model linked below.

OK…The RiggedSimple model ends up with two ‘bones’ that make up the ‘skeleton’ part of the model. Those nodes indexes are 3 & 4. Great and it appears that node 3 is the root. This is confirmed in the Skins array. Cool. Skins array point to an accessor for the invBindMatrices and this is a Mat4 array of two elements. Cool. The Skin also has a Joints array with 3 & 4. Cool. It is basically saying that the first InvBinMat in element 0 belongs to node 3 as joints[0] == 3. invBinMat[1] belongs to node 4 as joints[1] == 4. Again I can buy this.

It becomes less clear to me when we get to the shader inputs. The joints data in the VAO data is all 0 & 1 for the joint effecting the mesh. Weights I agree with. Then there is the Mat4 array that is sent to the shader. I think this is where my troubles begin. In this simple example, there are two matrices and getting them in the correct order is 50/50. But in large more complex models the joint counts increase. This boils down to the question…

*** Does the Skin/Joints array (besides from the indexes to the invBindMats) also indicate the location of the node’s transform in the matrix sent to the shader? *** Meaning…node #3 is the root and its completed transform goes in slot 0 of the array sent to the shader, and node #4 to slot 1. This is coming up a lot for me in some of the more complex models. I am also using, for example, the running cowboy from a ThinMatrix tutorial. The mesh is there and looks kind of like a person but kind of creepy in the same respect. :wink: I am suspecting that the placement of the matrices in the array to the shader are not correct and I am attempting to confirm the theory.

The rigged sample is simple and in my implementation looks correct. I am also using the simpler SimpleSkinned example, it looks different, as it bends the top points rotate all the way to the bottom points so there a translation thing not quite right. The cowboy is like 50% correct. I also have a dancing storm trooper and a vanguard type suite guy, those look like the Thing alien. Passing all identities in the array to the shader renders all models in there bind pose so i can verify that the pipeline seems correct. I strongly suspect the placement in the mat4 array to the shader BUT looking for positive reinforcement that I am looking in the correct place. Note…I’ve tinkered here and it seems to be making it worse BUT I may need to step away for a while and regroup.

Insights appreciated…


Had some time tonight…answer is yes…my models, even complex ones, are now animating correctly. Either I missed something in the spec, its implied OR secret magic sauce. Assuming implied… :wink:

skin->joints[] == what TRS set for a joint goes where.

  • joints[] == [3, 4], then joint #3 TRS goes in [0] and joint #4 goes in [1].

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.