Transforming a 4x4 matrix from one base to another

In summary, the conversation is discussing the difference between the coordinate systems used in 3D studio max and OpenGL and how to convert a matrix from one system to the other. The solution is to use a specific matrix that swaps the y and z axes, and the conversation also mentions the possibility of using other matrices for the conversion.
  • #1
AdrianM
2
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
  • #2
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.
 
  • #3
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.
 
  • #4
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]
 

1. What is a 4x4 matrix?

A 4x4 matrix is a rectangular array of numbers in a specific order that can represent a variety of mathematical operations, such as transformations or linear equations.

2. What does it mean to transform a 4x4 matrix?

Transforming a 4x4 matrix refers to changing the values of the matrix in a specific way, such as rotating, scaling, or translating it, in order to achieve a desired result. This is often done in computer graphics and 3D modeling.

3. What is a base in relation to a 4x4 matrix?

A base is a set of vectors that serve as a frame of reference for a 4x4 matrix. It defines the coordinate system in which the matrix is represented.

4. Why would you need to transform a 4x4 matrix from one base to another?

Transforming a 4x4 matrix from one base to another is necessary when working with multiple coordinate systems. For example, in 3D modeling, a 4x4 matrix may need to be transformed from a local coordinate system to a global one in order to accurately position an object in a scene.

5. What are the steps involved in transforming a 4x4 matrix from one base to another?

The steps involved in transforming a 4x4 matrix from one base to another include finding the transformation matrix, multiplying it by the original matrix, and then multiplying the result by the inverse of the base matrix. This will result in a new matrix that is transformed to the desired base.

Similar threads

Replies
12
Views
3K
Replies
31
Views
2K
  • Linear and Abstract Algebra
Replies
5
Views
2K
  • Differential Equations
Replies
7
Views
2K
  • Precalculus Mathematics Homework Help
Replies
13
Views
896
  • Linear and Abstract Algebra
Replies
1
Views
754
  • Linear and Abstract Algebra
Replies
17
Views
4K
  • Advanced Physics Homework Help
Replies
20
Views
1K
Replies
2
Views
4K
Back
Top