Transforming a 4x4 matrix from one base to another

  • Context: Graduate 
  • Thread starter Thread starter AdrianM
  • Start date Start date
  • Tags Tags
    Base Matrix
Click For Summary

Discussion Overview

The discussion centers on the conversion of a 4x4 matrix from the coordinate system used in 3D Studio Max to that used in OpenGL, specifically in the context of exporting skeletal animation. The conversation explores the differences between the right-handed and left-handed coordinate systems and how these affect matrix transformations.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant describes the coordinate systems of 3D Studio Max and OpenGL, noting the differences in axis orientations.
  • Another participant proposes a transformation matrix to convert coordinates from 3D Studio Max to OpenGL, suggesting that (x, y, z) in 3D Studio Max corresponds to (-x, z, y) in OpenGL.
  • A later reply questions the origin of the -x transformation, stating that their method converts points from (x, y, z) to (x, z, -y) and works correctly for their application.
  • Participants discuss the properties of the proposed transformation matrix, including its self-inverse nature.
  • One participant acknowledges a misunderstanding regarding the direction of the OpenGL x-axis and corrects the transformation matrix accordingly.

Areas of Agreement / Disagreement

There is no consensus on the correct transformation method, as participants present differing approaches to converting the matrix, leading to ongoing debate about the appropriate transformations.

Contextual Notes

Participants express uncertainty regarding the specifics of matrix conversion, including the handling of translation components in 4x4 matrices and the implications of different coordinate system conventions.

AdrianM
Messages
2
Reaction score
0
I'm writing an exporter for 3d studio max and i want to export skeletal animation. 3D studio max uses a coordinate system that has the X axis going from left to right, the Z Axis going from bottom to top and the Y axis going from front to back. Opengl uses a left handed coordinate system, whilst 3d max uses a right handed coordinate system. OpenGL's X axis goes from left to right, Y goes from bottom to top and Z goes from back to front.

I want to convert a 3d studio max matrix to use it with OpenGL. Matrices hold transformation information. How can i accomplish this?
 
Physics news on Phys.org
AdrianM said:
I'm writing an exporter for 3d studio max and i want to export skeletal animation. 3D studio max uses a coordinate system that has the X axis going from left to right, the Z Axis going from bottom to top and the Y axis going from front to back. Opengl uses a left handed coordinate system, whilst 3d max uses a right handed coordinate system. OpenGL's X axis goes from left to right, Y goes from bottom to top and Z goes from back to front.

I want to convert a 3d studio max matrix to use it with OpenGL. Matrices hold transformation information. How can i accomplish this?
Sounds to me like (x, y, z) in 3D studio max goes to (-x, z, y) in OpenGL. The matrix
[tex]\left[\begin{array}{ccc}-1 & 0 & 0 \\ 0 & 0 & 1\\ 0 & 1 & 0\end{array}\right][/tex]
will do that.

That matrix happens to have the nice property that it is its own inverse (because the inverse of changing x to -x is changing x to -x and the inverse of swapping y and z is to swap y and z) so you can also use it to change coord systems the other way.
 
HallsofIvy said:
Sounds to me like (x, y, z) in 3D studio max goes to (-x, z, y) in OpenGL. The matrix
[tex]\left[\begin{array}{ccc}-1 & 0 & 0 \\ 0 & 0 & 1\\ 0 & 1 & 0\end{array}\right][/tex]
will do that.

That matrix happens to have the nice property that it is its own inverse (because the inverse of changing x to -x is changing x to -x and the inverse of swapping y and z is to swap y and z) so you can also use it to change coord systems the other way.

I think i don't know where -X is coming from. In the phase where i load the static model i convert every 3d studio max point from (x,y,z) to (x,z,-y) and it works fine. 3D studio max uses 4x4 matrices that contain on the last row a translation component. I tried converting a 3d studio max matrix into an opengl in quite a few ways but i had no luck :confused:. So your matrix indeed converts a point from (x,yz) to (-x,z,y), which is not what I'm doing. What I'm interested though is how to convert a 4x4 row major 3ds matrix into a 4x4 column major ogl matrix.
 
My fault. I misread and thought OpenGL's x-axis went from right to left! The correct matrix is
[tex]\left[\begin{array}{ccc}1 & 0 & 0 \\ 0 & 0 & 1\\ 0 & 1 & 0\end{array}\right][/tex]
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 12 ·
Replies
12
Views
5K
Replies
31
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
5K
  • · Replies 17 ·
Replies
17
Views
7K
  • · Replies 1 ·
Replies
1
Views
3K