Sign in to follow this  

Bone and Skeletal Animation - solved

This topic is 3297 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everyone, I've been working for the past two days on OpenGL skinning and skeletal animation. I'm loading a DirectX file into my code, and the loading process has gone very smoothly. Now I'm trying to use a GLSL shader to manipulate the vertices to match bone positions. The GLSL is fairly straight forward, and I don't believe it to be the problem. Nor do I believe that my interleaved VBOs are the problem (since vertices, normals, and everything else seems to be working). I think the problem lies with how my bone transform matrices are calculated. The DirectX format stores a default transformation matrix for each bone. I've loaded those in and am trying to apply them before moving onto actually using the AnimationSet data. So here's how I've been calculating the DerivedMatrix that is used as the GLSL uniform.
        /// <summary>
        /// Calculates the derived transform matrix.
        /// </summary>
        public void CalculateDerived()
        {
            if (b_parent != null) b_derived = b_transform * b_parent.DerivedMatrix;
            else b_derived = b_transform;
            foreach (Bone p_bone in b_children) p_bone.CalculateDerived();
        }



b_derived is the private Matrix4 that stores the DerivedMatrix of that bone. Is there something else that I need to take into account? I get some very strange data (warning: creepy) Big Problems... - jpg Does anyone have any suggestions? Are the default transformation matrices supposed to work? I have not adjusted the position of the bones or anything like that because I thought that multiplying a bone by its parents would do that for me... is this assumption correct? Thanks in advance. Giawa Solved I needed to multiply my derived matrix by the skin offset matrix. But that final matrix is NOT the derived matrix, they're two different things. Then use the final matrix to pass as the uniform to GLSL. After keyframe applied - jpg Before keyframe applied - jpg New code: b_final is used for passing to GLSL
        /// <summary>
        /// Calculates the derived transform matrix.
        /// </summary>
        public void CalculateDerived()
        {
            if (b_parent != null) b_derived = b_transform * b_parent.DerivedMatrix;
            else b_derived = b_transform;
            b_final = b_skinoffset * b_derived;
            foreach (Bone p_bone in b_children) p_bone.CalculateDerived();
        }

[Edited by - Giawa on December 6, 2008 7:52:08 PM]

Share this post


Link to post
Share on other sites

This topic is 3297 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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