# Blender Coordinate System to OpenGL

Some simple transformations may require when we import a 3d model from a modeling package which uses different coordinate system than the 3D engine we use. Though both Blender and OpenGL use right handed coordinate system, Blender is designed to have its z axis point upwards. So if we import a 3d model which is created in Blender with its height along Z axis, the model seem to aligned with the view direction if we try to draw it in OpenGL with the default model, projection transformations. We need to apply some rotations, translations as well as some vertex reordering to make the geometry visually appear similar to where we have created it.

I hope Blender has its coordinate system pretty hard coded into this. And I found this question in a few game development forums asking for a solution.

I find there are two solutions to overcome this.

##### Method 1

Multiply the transformation matrix of the scenegraph root node with a rotation matrix of -90 degrees around x axis.

##### Method 2

Alter the transformation matrices in the scene nodes of the scene graph also alter all the mesh vertices and normals.

That is, for every vertex (x, y, z) in a model created within the Blender modify the coordinate to (x, z, -y)

(x, y,z) => (x, z, -y)

Since all the mesh vertices has been altered, we need to alter the transformation matrices also.

For every transformation matrix in the scene graph, 1. Swap 2nd and 3rd columns 2. Swap 2nd and 3rd rows 3. Negate the 3rd column 4. Negate the 3rd row

It works fine for me. Comments and feedbacks are always welcome.

## Comment (

1)