Sign in to follow this  
codewings

Help! Calculate a matrix form S, R, T is wrong.

Recommended Posts

Hi, I am a new guy of game industry. Now I am writing a exporter for animation. I use two vector3 and a quaternion to store the bind pose and the key frame of each bone. But I found sometimes these component cannot be revert to the original matrix. I disassemble the matrix into S,R,T and calculate the transform by these value. The each value of the 3x3 part in the result matrix is the negative one of the original matrix. Currently I only found one bone has this situation. All others are correct. I tried my matrix class and D3D matrix. It still has this problem. I have not idea now. Can anyone give me some hint or answer? Thanks in advance.

Share this post


Link to post
Share on other sites
How are you extracting the components? If you're not careful, you can get a reflection in the rotation, and another in the scale.

Share this post


Link to post
Share on other sites
At beginning, I use my matrix class. But after I found this problem, I tried the matrix class supported by 3dsmax SDK and D3D matrix.

The methods in all these class can give the correct result except a bone in a simple animation.

Now I am using GMatrix::Scaling(), GMatrix::Rotation() and GMatrix::Translation().

Share this post


Link to post
Share on other sites
Some things you should check:

Are you multiplying the matrices in the right order, to get your original matrix again? So like scale * rot * pos versus pos * rot * scale. I assume you do this correct since you say it works for most cases.

It sounds like you might be using non-uniform scale. Check if the scale.x == scale.y == scale.z. If not, you need to introduce a scale rotation matrix as well to perform the scaling in another space. Since it happens on just one node so far this might very well be your problem.

Share this post


Link to post
Share on other sites
There is no scaling in my animation. I have checked everything I know. And I also found that the angle of the quaternion exact from the new matrix plus the angle of the original quaternion is nearly 2PI.

But I don't know if it is the key of the problem.

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