Jump to content
  • Advertisement
Sign in to follow this  
masterbubu

FBX skeleton animation - need help

This topic is 2507 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

: )

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!