FBX skeleton animation - need help

Started by
3 comments, last by Hunter_Ex 12 years, 2 months ago

Hi,

I trying to understand the viewScene example… I have two problems:

1.
I have cylinder skinned to 2 joints skeleton. I’m trying to move the skeleton in space by
adding translation to the global position of the node. The problem is that the skeleton does transformed, however the skin does not follows the skeleton movement. I have also tried to add the translation to the cluster matrix (pCluster->GetTransformMatrix()), but the results were bad.

2. In my Skeleton::Update function I’m doing:
(A) BoneW = ParentW * BoneL;

I have red online, that BoneL needs to be calculated as follows:
pCluster->GetTransformLinkMatrix(BoneL);
(B) BoneL = BoneL.Inverse(); But currently BoneL is not been calculated relative to its parent, and if I’ll multiply it
but the parentWorld, (A) equation will not hold.

If I’ll define :
pCluster->GetTransformLinkMatrix(BoneL);
© BoneL = ParentW.GetInverse() * BoneL; equation (A) will hold, but then BoneL is not in local space.

please help me in here I’m a bit confused

Advertisement
?
If the skeleton is working but your skin is not moving maybe your bindmatrices are wrong.

I can show how I get my matrices from my FBX loader.

1. Get all bones from an animation for example
KFbxXMatrix matrix = node->EvaluateLocalTransform(time) * NodeHelper::getNodeTransform(node);

2. Then bine pose matrices for each corresponding mesh deformation cluster

KFbxXMatrix globalMatrix;
lCluster->GetTransformMatrix(globalMatrix);
KFbxXMatrix geomMatrix = NodeHelper::getNodeTransform(mesh->GetNode());
globalMatrix *= geomMatrix;
KFbxXMatrix skin;
lCluster->GetTransformLinkMatrix(skin);
skin = globalMatrix.Inverse() * skin;
skin = skin.Inverse();

bindMatrixArray[index] = skin;


3. Then i build the hierarchy with the node transforms
absoluteNodeMatrix = localSpaceMatrix * parentMatrix;

4. Apply the inverse bind pose matrix
for (unsigned int i = 0; i < bones; ++i)
{
ShaderReadyBoneMatrix = bindMatrixArray * absoluteNodeMatrix;
}


5. Model renders fine

: )
Blekinge Institute of Technology
Twitter [twitter]devmoon[/twitter]
Homepage http://devmoon.se
Stream http://twitch.tv/devmoon
Hi,

tnx for the reply.

actually I'm interesting on how you got the joint local, and the parent matrices which holds:
BoneWorldMatrix = BoneLocalMatrix * ParentWorldMatrix.

my intention is to have the BoneWorldMatrix multiplied by KeyFrameMatrix.
KeyFrameMatrix matrix may be the identity if no animation applied, in that case, the skeleton needs to be
and the bind pose. Else, it should be animated.

Still I did not mange to get it right.
If you still not have solved the problem, I can show how I load the matrices

1. first find the root node of the skeleton
if (node->GetSkeleton())
{
...
}


2. then build the hierarchy, I do it with a recursive function
for (int i = 0; i < node->GetChildCount(); ++i)
{
parse(node->GetChild(i), childParent);
}


3. then as previously mentioned I get for each bone node its local matrix
KFbxXMatrix localBoneMatrix = node->GetScene()->GetEvaluator()->GetNodeLocalTransform(node);
// or use node->EvaluateLocalTransform(time) for animations


4. and you know which bones are parent bones since you loaded them in the correct hierarchy
Blekinge Institute of Technology
Twitter [twitter]devmoon[/twitter]
Homepage http://devmoon.se
Stream http://twitch.tv/devmoon

This topic is closed to new replies.

Advertisement