Sign in to follow this  
nachilau

How to convert 3D Max martix to DirectX matrix

Recommended Posts

Hello all, Can anyone give me any idea about the conversion of from the 3D studio max matrix to directX matrix. For translation, what I do right now is swapping the translation y and z, which means that Position in 3D Max: 3DMAX_x, 3DMAX_y, 3DMAX_z then in DirectX: DirectX_x = 3DMAX_x, DirectX_y = 3DMAX_z, DirectX_z = 3DMAX_y, However, I have problem with rotation, and scale. How can I transform the rotation and the scale to directX matrix. Thanks!

Share this post


Link to post
Share on other sites
Hi,

here's an old code snippet I use to convert matrices to DirectX format:


Matrix3 ConvertMatrixToDirectX(Matrix3 m)
{
Point3 row1, row2;
row1 = m.GetRow(1);
row2 = m.GetRow(2);

m.SetRow(1, row2);
m.SetRow(2, row1);

Point4 col1, col2;
col1 = m.GetColumn(1);
col2 = m.GetColumn(2);

m.SetColumn(1, col2);
m.SetColumn(2, col1);

return m;
}

Good luck!

Share this post


Link to post
Share on other sites
You can set up a conversion matrix (I won't give it to you since I don't know directx) and multiply every point, vector and matrix (which can contain rotation and scale) by it.
E.g. to convert to my engine's coordinate space I'm using conversion matrix X( Point3(1,0,0),Point3(0,1,0),Point3(0,0,1),Point3(0,0,0) ).

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