Help! Calculate a matrix form S, R, T is wrong.
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.
How are you extracting the components? If you're not careful, you can get a reflection in the rotation, and another in the scale.
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().
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().
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement