Jump to content
  • Advertisement
Sign in to follow this  
supagu

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.

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Why not RTFM and find out it's all well documented...

Share this post


Link to post
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 ]

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!