how does setBindingPose() work?

Problems building or running the engine, queries about how to use features etc.
michaweyel
Gnoblar
Posts: 21
Joined: Thu Dec 21, 2006 3:18 pm
Location: Germany

how does setBindingPose() work?

Post by michaweyel »

Hi all,

I am currently playing around with loading a skeleton plus mesh manually from a collada file. I am having a problem understanding the setBindingPose() function.

Isn't the bindingPose supposed to be just a matrix for each bone which defines which positions the bones were in when they were bound to the mesh?

And then, shouldn't the meshes vertex positions be multiplied by the inverse of these matrices when the mesh is transformed by a bone?

What I am doing now is that I transform the bones according to the bind poses I load from the collada file, then set the bind pose and then do any additional transformations. But this doesn't seem right, the meshes and bones are always rotated to much, by the exact amount of one bind pose rotation.

Does anyone know what i might be doing wrong?

Thanks,
-Michael
Last edited by michaweyel on Wed Oct 17, 2007 2:29 pm, edited 1 time in total.
cloud
Gremlin
Posts: 196
Joined: Tue Aug 08, 2006 6:45 pm
x 14

Post by cloud »

I think when you set a bind pose its like setting an initalState of the node, then any change of orientation is relative to this... I'm fairly sure this is correct.

Multipling by the UnitInverse of whatever inital orientation would take you back to the world x,y,z axies. The animation keyframe orientations are probably relative to the bind pose.

hope this helps.
michaweyel
Gnoblar
Posts: 21
Joined: Thu Dec 21, 2006 3:18 pm
Location: Germany

Post by michaweyel »

Hmm, I'm not sure. I always thought that the bind pose was not only the initial pose of the bones but also used transform the vertices from world to bone space in that initial position, basically like this:

B = bind pose matrix in world/model space
W = world/model space matrix of the joint
V = vertex position in bind pose

The skinning algorithm should work like this:

V' = (0, 0, 0);
for (int i=0; i<numInfluences; ++i)
V' += (V * (Inverse(B) * W)) * influences.weight;

Is this the way Ogre does it? Bc it seems that my mesh isn't affected at all by whatever bind pose I set.

-michael
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66

Post by sinbad »

That's only the algorithm if V is an absolute transform. Keyframes in ogre are delta values so the inverse is not needed for every vertex calculation. The bind pose sets the starting position and weighted transforms are then added incrementally to that.