• Advertisement
Sign in to follow this  

[Assimp] Getting bind pose bone positions

This topic is 1436 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

I'm trying to get my head around animation and Assimp. I'm trying to just get the bone positions in bind pose (no animation or anything like that). According to various sources, I should be able to use aiBone::mOffsetMatrix. The way I am doing it is (psuedo code):

MthVector4 v(0.0f, 0.0f, 0.0f, 1.0f);
MthMatrix invOffset = mOffsetMatrix;
invOffset.Inverse();
invOffset.Transform(v, v);
pos = (MthVector3&)v / v.w;

pos should give the position in model space, right? I've spent a while fiddling around with this stuff for a while but nothing looks right at all. So what is the correct way to do this?

 

Thanks.

Share this post


Link to post
Share on other sites
Advertisement

Ok, maybe a clearer question would be: What are aiBone::mOffsetMatrix and aiNode::mTransformation, what is the difference and when/how should I use them?

 

Thanks.

Share this post


Link to post
Share on other sites

To my knowledge, assimp does not store bind pose.

 

The skeleton you have is stored in whatever frame 1 is.

 

The offset matrix is what you need to multiply a vertex (taking the joint's weight into account) by in order to get it into the bone space of frame 1.

 

I love assimp, but i can't stand the datastructures / orgonization / matrix handedness they chose.

Share this post


Link to post
Share on other sites
I got headache when I have worked on skinning with Assimp. Uglydavis has right, no bind pose.

I had to take a look to Assimp model viewer source code to get it working.

The bone matrices should be computed like that (or reverted depending of your matrix convention):

BoneWorldTransform * BoneOffsetMatrix * InverseRootNodeWorldTransform

Root node, is the root node of the aiScene (not the skeleton root node).

Hope this helps ! Edited by DTR666

Share this post


Link to post
Share on other sites

What you're doing appears to be fine. If you need more help, you'll have to provide more information than "nothing looks right."

 

I'm not particularly familiar with Assimp, but, as mentioned above, the offset matrix transforms a position in root node space to bone space. For example, assume a mesh vertex is positioned (0, 20, 5) with respect to the root node. If a bone is positioned at (0, 19, 4) with respect to the root node, the offset matrix will transform the position to ( 0, 1, 1) (ignoring rotations and scaling).

 

According to the Assimp docs, mTransformation is a bone's orientation with respect to its parent bone.

Edited by Buckeye

Share this post


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

  • Advertisement