[Assimp] Getting bind pose bone positions

Started by
3 comments, last by Buckeye 10 years, 2 months ago

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.

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.

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.

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 !

----

www.winthatwar.com

Download our latest demo here.

www.insaneunity.com

@InsaneUnity

@DTR666

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.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

This topic is closed to new replies.

Advertisement