Results 1 to 5 of 5

Thread: Collada skeleton hierarchy

  1. #1

    Collada skeleton hierarchy

    Hello everyone. The collada skinning equation is the following:

    v +={[(v * BSM)*IBMi*JMi]* JW}

    • n : The number of joints that influence vertex v
    • BSM: Bind-shape matrix
    • IBMi: Inverse bind-pose matrix of joint i
    • JMi: Transformation matrix of joint i
    • JW: Weight of the influence of joint i on vertex v

    So far I understand. What I do not understand is how this applies when a particular bone is son of another bone.

    Should I do this?


    v
    +={[(v *ParentBSM* BSM)*ParentIBMi*IBMi*ParentJMi*JMi]*ParentJW* JW}

    Or, what do I have to do so that the transformations of the children are done well in relation to the parents?

    Thank you very much for your help.

  2. #2
    Senior Member
    Join Date
    Mar 2016
    Posts
    120
    If I'm not mistaken there is code here (https://sourceforge.net/p/collada-do...Controller.cpp) where I've implemented this for arbitrarily parented skeletons and morph targets.

    I think normally you roll IBMi and JMi together somehow, so they are one matrix. Then you multiply as a chain just like with static geometry. Depending on how things are set up I think IBMi may be optional. BSM is probably optional too. This is not really a COLLADA problem. But there you are

    P.S. These are all conveniences for artists. An efficient animation isn't parented, and doesn't require bind-poses, etc. You want to get rid of all those things if your application is not arts software.

    EDITED: In that link... don't read the following comment... It's driving me mad now trying to think of what I had to say!
    //COLLADA uses the concept of a "base mesh" but it
    //is really no different from another target. Most
    //systems won't make this distinction, since there
    //is a need to blend key frames when all are equal.
    Last edited by Mick P.; 01-11-2019 at 08:49 PM.
    This account can Moderator spam in the COLLADA forum.
    ColladaDOM 3 (COLLADA-DOM 2016)
    https://sourceforge.net/p/collada-do...ussion/531263/

  3. #3
    I am going to try. Thank you very much for your response, friend

  4. #4
    This is good question I think,

    I guess BSM and IBMi are in world space (I'm not sure for certain), in this case there is no need to ParentBSM and ParentIBMi, but JMi is joint transform (in scene graph?) and that is hierarchical so ParentJMi is needed (assuming we are speaking for world-space skinning). JW is weight of a specific joint so why do we need to ParentJW? I guess we don't.

    Here what I did:

    Client:
    Code :
    jointMatrix[i] = jointTransformInWorldSpace[i] * skin->invBindPoses[i] * skin->bindShapeMatrix
     
    /*
    JMi  = jointTransformInWorldSpace[i], joint transform (not inverse) in scene in world space
    IBMi = skin->invBindPoses[i], comes from collada file, see INV_BIND_MATRIX input in <joints> element
    BSM  = skin->bindShapeMatrix, comes from collada file, see <bind_shape_matrix> in <skin> element
    JW   = WEIGHTS in shader
    n    = used as 4 for now like vec4.
    */

    Vertex Shader:
    Code :
    ...
    \n#ifdef JOINT_COUNT\n
    layout (std140) uniform JointBlock {
      mat4 uJoints[JOINT_COUNT];
    };
     
    in uvec4 JOINTS;
    in vec4  WEIGHTS;
    \n#endif\n
    ...
    \n#ifdef JOINT_COUNT\n
      mat4 skinMat;
     
      skinMat = uJoints[JOINTS.x] * WEIGHTS.x
              + uJoints[JOINTS.y] * WEIGHTS.y
              + uJoints[JOINTS.z] * WEIGHTS.z
              + uJoints[JOINTS.w] * WEIGHTS.w;
     
      pos4  = skinMat * pos4;
      norm4 = skinMat * norm4;
    \n#endif\n
    ...
    \n#ifdef JOINT_COUNT\n
      gl_Position = VP * pos4;
    \n#else\n
      gl_Position = MVP * pos4;
    \n#endif\n

    I used jointMatrix as uJoints in vertex shader.

    In the future I may update my implementation to improve or fix bugs...
    Last edited by recp; 01-18-2019 at 12:08 AM.

  5. #5
    Senior Member
    Join Date
    Mar 2016
    Posts
    120
    @Recep, hey, just FYI I've been developing COLLADA-DOM again what seems like all through December and January. It's driving me nuts to get it off my back. The new round of code started back further, in October. I took a break shortly after, but after beginning again sometime in December I have just been trying to find a stopping point. Everything in the new code I would file under advanced XML features/facilities (https://sourceforge.net/p/collada-do...ad/6445b0224b/)
    This account can Moderator spam in the COLLADA forum.
    ColladaDOM 3 (COLLADA-DOM 2016)
    https://sourceforge.net/p/collada-do...ussion/531263/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean