Previous Thread  Next Thread

chat icon Blender Matrix to OpenGL Matrix

Link2012

Posted: Wed Feb 06, 2013 6:32 pm
Joined: 06 Feb 2013
Posts: 1
My problem is, Blender uses Z for up and I use Y for up, so things get different when I export.

I created a custom exporter, this file format has a matrix for each mesh, the matrix contains all transformations and will just be multiplied with the modelview on OpenGL, so here the great problem comes, the matrix is a little different from how it should be on OpenGL because Blender uses Z for up.

So, there's any way to convert the Blender Matrix to OpenGL matrix? If yes, how?
Reply with quote


robognome

Posted: Thu Feb 14, 2013 3:14 am
Joined: 14 Feb 2013
Posts: 1
I dont know about opengl world coordinates but I think you just need to swap the y and z coordinates.

I know this sounds too easy but it works. However...

You should note that this converts the coordinate system from blender's right handed system to a left handed system with the z-axis positive direction toward the back camera. If you need to z axis positive coming toward the front-view camera then just negate the z-value (after swapping the axis).
Reply with quote


ldo

Posted: Fri Mar 08, 2013 9:19 am
Joined: 07 Nov 2010
Posts: 544
Say Blender coords are (X, Y, Z), OpenGL are (X', Y', Z'). Then the coordinate orientations are:

Blender: X to right, Y away from you, Z up.

OpenGL: X' to right, Y' up, Z' towards you.

Therefore:

X' = X
Y' = Z
Z' = -Y
Reply with quote


 
Jump to:  
Powered by phpBB © 2001, 2005 phpBB Group