FBX skeleton animation - need help
Hi,
I trying to understand the viewScene example… I have two problems:
1.
2. In my Skeleton::Update function I’m doing:
I have red online, that BoneL needs to be calculated as follows:
If I’ll define :
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
2. Then bine pose matrices for each corresponding mesh deformation cluster
3. Then i build the hierarchy with the node transforms
4. Apply the inverse bind pose matrix
5. Model renders fine
: )
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
: )
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.
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
2. then build the hierarchy, I do it with a recursive function
3. then as previously mentioned I get for each bone node its local matrix
4. and you know which bones are parent bones since you loaded them in the correct hierarchy
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement