I’m currently developing a game and I am trying to add skeletal animation support. I watched this video about the subject which gave me great base to start.
Now I’ve been messing around for days in FBXSDK but data seems to always be wrong. I was wondering what is the proper way of getting the skeleton information / bind pose?
I got the parent indices correct. I am just recursively going over each node, checking if its a bone etc. And this seems to be working fine.
void ImporterFBX::processSkeleton(FbxNode *_node)
{
for (uint32_t ii = 0; ii < _node->GetChildCount(); ++ii)
{
FbxNode *currNode = _node->GetChild(ii);
processSkeletonRecursively(currNode, 0, UINT32_MAX);
}
}
void ImporterFBX::processSkeletonRecursively(FbxNode *_node, uint32_t _index, uint32_t _parentIndex)
{
if (_node->GetNodeAttribute() && _node->GetNodeAttribute()->GetAttributeType() && _node->GetNodeAttribute()->GetAttributeType() == FbxNodeAttribute::eSkeleton)
{
m_bones.insert(_node->GetName(), _index);
m_skeleton->parents.insert(_index, _parentIndex);
}
for (uint32_t ii = 0; ii < _node->GetChildCount(); ii++)
{
processSkeletonRecursively(_node->GetChild(ii), m_bones.size(), _index);
}
}
The problem I have right now is,- how do I get the local bind matrix (bindLocal) for each bone? This doesnt work as expected:
FbxAMatrix bindLocal = _node->EvaluateLocalTransform();
And how do I get the inverse bind model matrix (bindInvModel) for each bone? This doesnt work as expected:
FbxAMatrix bindInvModel = _node->EvaluateGlobalTransform().Inverse();
And final question, in the video he multiplies the parent of the locals. Is there any point in having the local matrix for each bone in bind pose at runtime? Or can I just use global? I know local is needed for the animation data because of interpolation, but is it needed for the bind pose?
I’ve tried a lot of different solutions just browsing old forums (most things that come up when I google are from back in 2008), trying to understand fbxsdk documentation but its not really clear since FBX can be used for so much more than video games. Im also confused because there are FbxPose* structs. And ->isBindPose() api. Why are noone talking about this?
Marcus Madland is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.