Jump to content
  • Advertisement
Sign in to follow this  
nachilau

How to convert 3D Max martix to DirectX matrix

This topic is 4067 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

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!