Results 1 to 4 of 4

Thread: How Can i use Animation Data...

  1. #1
    Junior Member
    Join Date
    Jun 2009
    Posts
    8

    How Can i use Animation Data...

    hi All,

    I have a collada exporter, in which i am reading animation keyframes data as Matrices...

    what i don't understand now is.. how am i suppose to use that Animation Data..

    what i am doing is that i extract the Keyframe Matrix for each Bone's each Keyframe from all the channels in to One matrix..

    In my current implementation.. i have "Local" "World" matrices... "Local" is the Bindpose Matrix of each Joint.. NOTE: Its not the Bindshape Matrix.. which is only one for the whole skeleton.. this is also not the "inverseBindMatrix" for each bone.. and "World" is the Combined Matrix For each Joint. considering its Parent's Transformation...

    What i am currently doing is, when i want to animate the Skeleton.. i take the "Local" and if it has any animation keys.. i take the animation key Transformation Matrix and "add" it to "Local" (now i know this must be some multiplication etc) but just for testing purposes.. this is what i am doing .. and the result is an animated Skeleton BUT its larger then the Current Skeleton.. like 5 times bigger then the skeleton..

    This is the equation

    CurrentBoneWorldMatrix = (CurrentBoneLocal + CurrentBone[Keyframe].Transformation) * CurrentBoneParentWorldMatrix;

    So in this context (using "Local" and "World" matrices) how am i going to use the Keyframe Transformation Matrix?


    any help would be greately appriciated..

  2. #2
    Junior Member
    Join Date
    Aug 2007
    Location
    Dundee
    Posts
    10

    Re: How Can i use Animation Data...

    Hi waZim,

    You should not be doing any matrix add operation. I've written a sort of pseudo code method below. In the method, the "_animBoneTransforms" array contains the animation matrices you extract from the DAE file (or if you are interpolating, then it contains an interpolated set of matrices between two keyframes from the data you loaded), note that these are in bone local space. "_skinningPalette" doesn't contain anything at first, but is the same size as the "_animBoneTransforms" array. In your application you call the "CalculatePose" method (shown below) with the root bone of the skeleton. Hope this helps.........

    void CalculateSkinningPalette(Bone _bone, Matrix[] _animBoneTransforms, Matrix[] _skinningPalette)
    {
    if (bone.Parent == null)
    {
    _skinningPalette[bone.Index] = _animBoneTransforms[bone.Index];
    }
    else
    {
    _skinningPalette[bone.Index] = _animBoneTransforms[bone.Index] * _skinningPalette[bone.Parent.Index];
    }

    for (int i = 0; i < bone.Children.Count; i++)
    {
    CalculatePose(bone.Children[i] _animBoneTransforms, _skinningPalette);
    }

    }

    Cheers,
    Hughel

  3. #3
    Member
    Join Date
    Feb 2005
    Location
    San Jose, CA
    Posts
    63

    Re: How Can i use Animation Data...

    Hi,

    Animation in COLLADA targets transform values. It could target a single value like rotation angle in <rotate> or the whole 4x4 matrix in <matrix>
    In your case, the whole animation frame at a given time might be a 4x4 matrix.
    This 4x4 matrix will be updating the values of skeleton matrix stack instead of adding transforms into your skeleton matrix stack.
    When a given skeleton transform is being updated, all children skeleton will need to be updated.
    In summery, you should follow these steps for skinning and animation.
    1. interpolate key frames at time t and update animation targets like skeleton transforms.
    2. update new local matrix and new local to root skeleton matrix for skinning purposes.
    3. update your new vertices attributes base on the source geometry, updated skeleton matrices, and skinning information.

    Animation in COLLADA is very limited.
    Keep in mind that animation can't target something like morph weight, vertex position, or texture coordinate.

    Have fun,
    Herbert

  4. #4
    Junior Member
    Join Date
    Jun 2009
    Posts
    8

    Re: How Can i use Animation Data...

    Thanks a bunch both of your replies,

    I was doing the same before but there was another problem with the animation data which was creating the collapsed skeleton after i apply it.

    and the problem is with Collada Max Exporter. when you export with baked matrices... it does not export the homogenous coordinates normalized.. instead they are all zeros.

    and now i can see the skeleton animating.

Posting Permissions

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