Sign in to follow this  
MeshMan

MD3 Animation In DirectX

Recommended Posts

Hi, I've been trying Quake3 MD3 animation for the past 2 days and I'm having really bad problems with the interpolation of the tags. A tag has a 3x3 rotation matrix which i convert to quaternions, do my SLERP and back to a matrix. But as yoy may know, the coordnate system in Q3 is Y on the positive Z and Z being positive Y. No matter what I try, i can't seem to make the rotations of the models happen in the right axis. Like my players head spins around the Y axis when it should be spinning on the Z. I tried swapping the Y-Z axis in the 3x3 TAG matrix before converting to quaternions but it just messes up the animation (it skews and flattens the model), and even tried swapping YZ on the final matrix but this sort of cancels out all the translations of the individual models (head, torso, legs). I cant even find any DirectX samples of MD3 loading and rendering. Can someine please help... Thanks, MeshMan

Share this post


Link to post
Share on other sites
I've already swapped the YZ of the vertices when I load in the data to conform with my DirectX coordinate system.

I just can't figure out how to correct this rotation matrix into the correct coordinate system I need it in.

Still stuck...

Share this post


Link to post
Share on other sites
I wouldn't swap the vertices at load-time because the rotations wouldn't be correct. Just tell the model system that Z is up and Y is forward, and at the last minute go "PSYCHE!" and swap them, just before you do the world transform.

Share this post


Link to post
Share on other sites
To convert a right handed matrix or vector to left handed or vice versa, you have to multiply your vector or matrix by this matrix:

1 0 0 0
0 0 1 0
0 1 0 0
0 0 0 1

If it does not work in the first try A x B try B x A. But you need 4x4 matrices. Extend your 3x3 matrix via transpose or invert.

Share this post


Link to post
Share on other sites
I've managed to get round it by converting the matrices to D3D style matrices as I was already doing, then when I convert them matrices to quaternions, i just swap the Y/Z on the quaternions and my output is all perfect.

Screenies here:

www.meshsoft.net/dragon.jpg
www.meshsoft.net/md3.jpg

:)

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