Jump to content

  • Log In with Google      Sign In   
  • Create Account

[Assimp] Getting bind pose bone positions


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 stu_pidd_cow   Crossbones+   -  Reputation: 2028

Like
0Likes
Like

Posted 04 February 2014 - 02:19 AM

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.



Sponsor:

#2 stu_pidd_cow   Crossbones+   -  Reputation: 2028

Like
0Likes
Like

Posted 04 February 2014 - 05:18 PM

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.



#3 uglybdavis   Members   -  Reputation: 958

Like
1Likes
Like

Posted 15 February 2014 - 11:16 PM

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.



#4 DTR666   Members   -  Reputation: 189

Like
1Likes
Like

Posted 16 February 2014 - 09:56 AM

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, 16 February 2014 - 04:03 PM.

----

 

www.winthatwar.com

 

Download our latest demo here.

 

www.insaneunity.com

@InsaneUnity

@DTR666

 


#5 Buckeye   Crossbones+   -  Reputation: 6214

Like
0Likes
Like

Posted 16 February 2014 - 03:32 PM

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, 16 February 2014 - 03:45 PM.

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





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS