# 3D Assimp bone structure

## Recommended Posts

Posted (edited)

global_inverse really has no relevance unless you want change the handedness of the coordinate system.

I've build my matrix pallette skinning based on the tutorial you linked and i all i do is multiply hierarchy and then offsetmatrix.
Note that "local" contains local space bone matrices after applying animation.
Also note that i do offsetMatrix * boneMatrix, not the other way around.

            Bone bone;
int count = skeleton.Length;

// multiply hierarchy
for (int i = 0; i < count; i++)
{
if (skeleton[i].Parent > -1)
Matrix.Multiply(ref local[i], ref local[skeleton[i].Parent], out local[i]);
}

// apply bone offset matrix
for (int i = 0; i < count; i++)
Matrix.Multiply(ref skeleton[i].OffsetMatrix, ref local[i], out world[i]);

Edited by chlerub

##### Share on other sites
Posted (edited)

Thanks to all!

The bug was in the drawing code. Now skeleton is visualizing correctly.

Actually some years ago i knew all this stuff very well and implemented skinning on directx.

Now gradually catching up opengl and 3d graphics again.

Now i see that the purpose of applying inverted root transformation is to put model to the default(zero) position and orientation. Probably some models are created in different handedness. But it's actually a bit stupid to apply that inverted transformation every frame since we can just adjust root transformation once during bone structure creation.

Quote

Also note that i do offsetMatrix * boneMatrix, not the other way around.

Probably in directx, i'm using opengl as rendering api.

Edited by _Flame_

##### Share on other sites
7 minutes ago, _Flame_ said:

[...]But it's actually a bit stupid to apply that inverted transformation every frame since we can just adjust root transformation once during bone structure creation[...]

Yep exactly.

##### Share on other sites
1 hour ago, chlerub said:

global_inverse really has no relevance unless you want change the handedness of the coordinate system.

Could you elaborate how this difference in handedness can appear?

## Create an account

Register a new account

• 17
• 9
• 15
• 60
• 84