# 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 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 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) ).

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628379
• Total Posts
2982349

• 10
• 9
• 15
• 24
• 11