PDA

View Full Version : how do you orient your models?



Junkstyle
07-19-2002, 08:41 AM
In terms of Forward, Up, Right vectors how should I orient my models?

Forward = positive X axis or negative Z axis?
Up = positive Y axis ?

coredump
07-19-2002, 06:08 PM
whatever works. i use these:
right = <1,0,0>
up = <0,1,0>
look = <0,0,-1>

b

Nakoruru
07-19-2002, 07:39 PM
I always thought that Z made more sense as up and down. Just because Y is always "up" on the blackboard (where we learned about coordinate systems in the first place) doesn't mean it should be "up" in the world. Laying out the floor plan or map of something in X,Y is more intuitive than doing it in X,Z (IMHO). Think about a blue-print.

Do it anyway you want. But whatever way you do it you have to be consistent.

You may also want to decide that all models should face in the same direction if they have a front. I would chose +Y, which would be 'north' in my convention.

Also, you have to decide where to put the bottom of the model. I'm not sure if its more convenient to put the center of gravity at 0, 0, 0 and then decide to use some additional information to say how far that is from the ground, or to put the bottom at Z=0 and then use an extra piece of information to say where the center of gravity is (neither is more efficient than the other).

I just had to put my 2 cents in. Its one of my pet pieves that people use Z as a coordinate that people move along the ground in. It seems like the only reason is that they have it locked into their heads that Y = UP, when Y is only up on the blackboard and in eye space (its toward the front of the class on your paper). Its not a problem as long as they can think that way, but to me its a stumbling block to thinking clearly since people do not tend to think in 3 dimensions, but 2 (north/south, east/west) and it seems easier to me to map those to Y+/Y-, X+/X- then X+/X-, Z+/Z-




[This message has been edited by Nakoruru (edited 07-20-2002).]

Jambolo
07-22-2002, 11:53 PM
It is almost completely arbitrary. Here are some reasons for doing it a particular way:

-- In 3DS Max, Z is up by default.

-- In OpenGL view space, Y is up.

-- Z is generally considered up because XY is standard for 2D, and the Z axis extends into the 3rd dimension (up).

07-23-2002, 02:32 AM
On the other hand...

If you draw a human on a peace of paper, which direction is up for him? http://www.opengl.org/discussion_boards/ubb/smile.gif

Mats

Mezz
07-23-2002, 02:40 AM
Mackan: that depends on how you orient the paper http://www.opengl.org/discussion_boards/ubb/smile.gif

Basically, in general it doesn't matter which you choose - as long as you're consistent with it. You can make the choice based on whatever you're comfortable with, and also what makes your life easier for doing things like importing models.

-Mezz

Andrea Rossini
07-23-2002, 05:51 AM
I assume
+Z is Up
+X is East
+Y is North

I start the cam (and models) looking East

I Yaw around Z
I Pitch around Y
I Roll (joi...Emmmh) around X

Junkstyle
07-23-2002, 10:52 AM
This is good stuff thanks guys. So EVENTUALLY I wont be making my spaceships by hand, I'll borrow/write some 3ds loader. Knowing that 3ds uses +Z axis as up might be helpful. Right now I'm using +Y as up and +Z as forward, but I can change that. Is 3ds right handed?

Another question: If all my models use +Z axis as up, does that mean I should orient the "world" with +Z axis up? or should I do and extra transform? Knowing which way is up/forward/right is important for me because I will do all my movement calculations using those vectors. I just don't want to get stuck in a trap. I notice Teh Carmack uses +Z as up in quake2:

qglMatrixMode(GL_MODELVIEW);
qglLoadIdentity ();

qglRotatef (-90, 1, 0, 0); // put Z going up
qglRotatef (90, 0, 0, 1); // put Z going up
qglRotatef (-r_newrefdef.viewangles[2], 1, 0, 0);
qglRotatef (-r_newrefdef.viewangles[0], 0, 1, 0);
qglRotatef (-r_newrefdef.viewangles[1], 0, 0, 1);
qglTranslatef (-r_newrefdef.vieworg[0], -r_newrefdef.vieworg[1], -r_newrefdef.vieworg[2]);


I have no preference which way I should orient stuff so you guys are helping me decide.

Junkstyle
07-23-2002, 11:17 AM
I was just looking at the last post and did rotation code in my head:
qglRotatef (-90, 1, 0, 0); // put Z going up
qglRotatef (90, 0, 0, 1); // put Z going up

why on earth would you want the second rotation?

07-23-2002, 12:20 PM
Err... So that positive X-Values go into the screen?

Junkstyle
07-23-2002, 02:25 PM
yep thats the result. I was just wondering why. why not keep positive y going into the screen.