View Full Version : opengl axis

giuseppe500

08-05-2010, 07:48 AM

Hy.

I have create a collada importer , in opengl.

Now I'm try to export in collada from 3ds , but how are the opengl coords?Right hand or left hand(I think right hand) ?

I suppose that in 3ds i have a cordinate system that is not equal to opengl , how i can adapt the axis?

Thanks.

Rosario Leonardi

08-05-2010, 01:08 PM

openGL -> Maya, Blender, XSI Right handed (Y up, X on the right, Z toward you)

directX -> 3dStudio Max Left handed (Z up, X on the right, Y away from you)

To convert from Right to Left handed Swap Y with Z and negate the Z. Alternatively you can rotate by -90 deg on the X axis.

DmitryM

08-05-2010, 01:20 PM

I might be missing something, but none of your two methods seem to change the handiness of the coordinate space.

The handiness is Right when dot(Z, cross(X,Y)) == 1.

The handiness is Left when ... == -1

Any of the following operations switch your handiness (in general):

1. multiplying any axis by -1

2. swapping any two axis

Your proposed variants:

1. "Swap Y with Z and negate the Z" will switch twice, hence leaving the handiness, but screwing the coordinates

2. "rotate by -90 deg on the X axi" will not change the handiness

Rosario Leonardi

08-05-2010, 01:52 PM

Method 1 and 2 are equivalent

Swap Y with Z and negate the Z is like multiplying by

1 0 0 0

0 0 1 0

0 -1 0 0

0 0 0 1

that is the rotation matrix on X axis with alpha -90. No screwed coords.

Then I suppose it a matter of habits, I always associate Max with directX, sorry. :D

Max have Z up and Y away from you. It's a right handed system

DirectX use a left handed, Y up and Z away from you.

So, to recap. 3DS models are only rotated.

DmitryM

08-05-2010, 02:19 PM

Your matrix does *not* change handiness of a coordinate system.

"Rotations preserve handedness because they cannot change the ordering of the axes"

Taken from http://en.wikipedia.org/wiki/Rotation_matrix

Rosario Leonardi

08-05-2010, 04:21 PM

Question:

"I suppose that in 3ds i have a cordinate system that is not equal to openGL , how i can adapt the axis?"

Solution:

"Max have Z up and Y away from you. It's a right handed system

So, to recap. 3DS models are only rotated."

He don't want to swap from left handed to right handed. I'm sorry if I made a bit of confusion, but 3DS Max is the only (BIG) program in the world that use Z up. :-S

Powered by vBulletin® Version 4.2.5 Copyright © 2018 vBulletin Solutions Inc. All rights reserved.