Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 9 of 9

Thread: Need help with skeletal animation

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member Newbie
    Join Date
    Jun 2012

    Need help with skeletal animation

    I am new to skeletal animation and I have read that, to animate a mesh using skeletal I would have to use a hierarchy of bones which I did making each bone node in my scene graph and then to deform the mesh I have to get the inverse absolute matrix of the bone before interpolation (which I believe is what they call the pose) multiply that for the interpolated absolute matrix of the bone to get transition matrix and to deform the mesh I would have to multiply the vertex times the transition matrix times the weight and sum all this result with any other bone that deform the same vertex.

    to be more specific to get the absolute of each bone I do this

    Code cpp:
    void CNode::update()
       calculateAnimation();        //update the relativeMatrix with the interpolate keyfrmas
          absMatrix = Parent->absMatrix * relativeMatrix;
         absMatrix = RelativeMatrix;
       for(int n=0; n<child.count; n++)
          child[n]->update();      //keep going with the childrens

    now I get the inverse of this absMatrix matrix before any interpolation that change the relativeMatrix one time only so to do the vertex deformation in this function

    Code cpp:
    void CMesh::skinMesh(){
         CVec3 vec;
         for(int n=0; n < vertex.count; n++)
            for(int i; i < vertex[n].weight.count && vertex[n].bindBone[n] ; i++)
                vec+= vertex[n].bindBone[n]->transitionMatrix * vertex[n].weight[n]
            outVertex[n] = vec;

    that doesn't work for me because every vertex rotate around the center of the mesh axis instead of the parent of bone that deform the vertices, I thought it was logical considering that transition = InverAbs *absoulteMatrix will get me the the amount of rotation the bone has gain due to the interpolation so assuming it rotate 20 degrees the vertices will rotate 20 deg from the vertices origin so I guess I am missing something to make the vertices rotation around the parent of the bone which is deforming them,
    the only way I could make it work was to transform the vertex with the inverse of the bone absolute matrix before interpolation and the with the interpolate absolute matrix, but that make it to slow since two multiplication happened instead of one, please help me.
    Last edited by Dark Photon; 10-27-2012 at 02:57 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts