# max coord system to opengl coord system

This topic is 4861 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Im working on a max exporter, and have been using igame which converts from max to opengl coord system, but there is some code that requires access to max sdk which means the quats and matrices are in max coord system (z up, y foward, x left) i need to convert this to ogl format (y up, z foward, x right). any idea on a matrix that can do this for me?

##### Share on other sites
Why not RTFM and find out it's all well documented...

##### Share on other sites
you need to simply exchange the axis

Quote:
 max sdk which means the quats and matrices are in max coord system (z up, y foward, x left)i need to convert this to ogl format (y up, z foward, x right).

here, consider a row major form.

ok so your x axis get's negated(mapped from left to right so your first row vector is
[-1 0 0]

your y axis gets mapped to the z axis so your second vector is this
[0 0 1]

NOTE:
I can't remember but I'm almost certian open gl's forward direction is actually the negative z direction if this is the case the vector is
[0 0 -1]

now your z axis gets mapped to the y axis
[0 1 0]

so your matrix in row major form would be

M_Max_To_OGL =
[-1 0 0 ]
[ 0 0 -1]
[ 0 1 0 ]

when you build a matrix you ask yourself the question
what are my axis's getting mapped to??
since our x axis([1 0 0]) is getting mapped to [-1 0 0] this is the first row of our matrix.

all that matters is what the axis do. if you understand what I mean this should be obvious(and informative) to you

[1 0 0]*M_MaxTo_OGL = [-1 0 0]
[0 1 0]*M_MaxTo_OGL = [0 0 -1]
[0 0 1]*M_MaxTo_OGL = [0 1 0]

Tim

//edit
if this is wrong try negating the z axis, I'm unclear on what you mean by forward direction. this would change the matrix to this
M_Max_To_OGL =
[-1 0 0 ]
[ 0 0 1]
[ 0 1 0 ]

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 14
• 11
• 29
• 15
• 41
• ### Forum Statistics

• Total Topics
634838
• Total Posts
3019568
×