Jump to content
  • Advertisement
Sign in to follow this  
_Flame_

3D Assimp bone structure

Recommended Posts

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 this post


Link to post
Share on other sites
Advertisement

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 this post


Link to post
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 this post


Link to post
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?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!