Archived

This topic is now archived and is closed to further replies.

TangentZ

Left-Handed vs Right-Handed

Recommended Posts

Personally, I find the Right-Handed coordinate system much more intuitive to work with. This may be due to the fact that I''m accustomed to 2D stuff first, where you only have (X,Y). So, naturally, I think of ''Z'' as the "height" or "elevation", with positive ''Z'' meaning above and negative ''Z'' meaning below. This describes exactly the Right-Handed system. Also, in Mathematics, it''s the Right-Handed system that gets used most. At least in all the textbooks that I have ever studied. I''ve seen code dealing with Left-Handed system, where they use (X,Z) for positiion and ''Y'' as the "height". Hmm... I don''t like that. Very awkward. So, what''s your reason for choosing one over the other? ~~~~ Kami no Itte ga ore ni zettai naru!

Share this post


Link to post
Share on other sites
quote:
I've seen code dealing with Left-Handed system, where they
use (X,Z) for positiion and 'Y' as the "height". Hmm...
I don't like that. Very awkward.



blah? if you are very nice you can have a left handed system where Z is used as "height". all that actually matters is how you place your camera. I think :And if you think of X as the horizonal axis, Y as the vertical axis and Z as a depth axis the code you have described isn't very awkward.

May The Gzoo Be With You!
~Lord Gzoo

[edited by - lord gzoo on July 15, 2002 12:34:33 AM]

Share this post


Link to post
Share on other sites
quote:
Original post by tangentz
Personally, I find the Right-Handed coordinate system much
more intuitive to work with. This may be due to the fact that
I''m accustomed to 2D stuff first, where you only have (X,Y).



That''s actually exactly why I like the left-handed system. I prefer to think of it as looking "into" the screen. So that my x,y coordinates are still relative the screen. Where the Z is my depth. That and the term z-buffer refers to the depth buffer. How can you think of a depth buffer that uses a vertical axis? ;P


Always remember, you''''re unique. Just like everyone else.

Share this post


Link to post
Share on other sites
This is the way I look at it. Pretend you are just looking out towards a field. Someone puts a piece of paper in front of you. X is left to right, Y is up and down on it. Z would be forward and back. I prever Z getting bigger as it goes away from the origin because (as I see it) as something goes away from you, it''s distance increases. Thats why I prefer the left-handed coordinate system.

BTW, in a right handed coordinate system y still points up and down. Are you saying that Z does tangentz?


"Love all, trust a few. Do wrong to none." - Shakespeare

Dirge - Aurelio Reis
www.CodeFortress.com

Share this post


Link to post
Share on other sites
Perhaps it''s clearer to distinguish between World and
Camera geometry.

I see the XY plane as "flat" on the ground and Z denotes the
height. No problem, this is right-handed.

Now for the camera, I see it as using XY being the screen,
(0,0) lower-left, and Z as the "depth". But, with positive
Z being "out" of the screen, while negative Z being "into"
the screen.

Another way to visualize this is that my eyes are always
positioned "above" the screen (positive Z) and every object
in the world is "below" the screen (negative Z).

Again, the camera is right-handed.


~~~~
Kami no Itte ga ore ni zettai naru!

Share this post


Link to post
Share on other sites
Thats an excellent point tangentz. I''ve always thought of the screen (physically, like, my monitor) looking into my game world, as an extension of myself. If I reverse that thinking, and pretend the screen is looking at me, then it makes sense to make the z negative.

"Love all, trust a few. Do wrong to none." - Shakespeare

Dirge - Aurelio Reis
www.CodeFortress.com
Current Causes:
Nissan sues Nissan

Share this post


Link to post
Share on other sites
For programmers working with graphics, the XY plane as monitor and Z into screen (LHS) into screen is more intuitive.

For pure mathematicians, Z point upwards (RHS) is the inituitive.

For mathematicians who are also programmers, they are happy with Z pointing outwards (OpenGL RHS).

It''s all a choice of preference and giving me one hell of headache when converting from one coordinate to another.

Share this post


Link to post
Share on other sites
Besides, you can easily switch between left and right handed coordinate systems in any api (DX, GL etc) simply by putting in a suitable projection matrix, or just multiplying by an appropriate matrix (i.e. identity with 3,3 being -1 instead) will switch from a "GL" system (RHS) to a "DX" system (LHS).

Its all still confusing tho sometimes.

Dæmin
(Dominik Grabiec)
dominik.grabiec@student.adelaide.edu.au

Share this post


Link to post
Share on other sites
I don't think people here understand the difference between the right handed and the left handed systems (or is it me??).

In BOTH systems X is left right, Y is up down. However, in left handed system Z increases as you go further inside the monitor and decreases as you get closer to yourself. In right handed system it's exactly the opposite, X decreases as you go further inside the monitor and increases as you get closer to yourself.

Left and right handed systems have absolutely nothing to do with whether you lay your world out on xz plane or on xy plane.

[edited by - kill on July 17, 2002 4:32:15 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by kill
I don''t think people here understand the difference between the right handed and the left handed systems (or is it me??).

In BOTH systems X is left right, Y is up down. However, in left handed system Z increases as you go further inside the monitor and decreases as you get closer to yourself. In right handed system it''s exactly the opposite, X decreases as you go further inside the monitor and increases as you get closer to yourself.

Left and right handed systems have absolutely nothing to do with whether you lay your world out on xz plane or on xy plane.

[edited by - kill on July 17, 2002 4:32:15 PM]


You are talking about Direct3D LHS and Opengl RHS only. There are 6 ways to represent a coordinate hand system. Look at 3dmax, the up axis is Z.

When you have to mix objects from different coordinate systems in one scene, then the conversion becomes a pain.

The worse thing is when skeletal bones come into the picture. Some programs like to use Y axis as bone direction, some use X, some use Z. Getting them to work together is a real pain.

Share this post


Link to post
Share on other sites
quote:
Original post by kill
Left and right handed [Camera] systems have absolutely nothing to do with whether you lay your world out on xz plane or on xy plane.



That''s the reason I separate the world and camera geometries,
because it''s easy to confuse the two.

Laying the world on the XZ plane with Y pointing up is the
Left-Handed system. In this case, the camera orientation
and the world is identical.

Laying the world on the XY plane with Z pointing up is
Right-Handed. In this case, the camera is rotated counter-clockwise
by 90 degrees on the X-axis.

It''s possible to mix the two, but I wouldn''t recommend it.
I''d say if you use RHS for camera, then use RHS for your
world, vice versa.


~~~~
Kami no Itte ga ore ni zettai naru!

Share this post


Link to post
Share on other sites
The math in your program can sometimes depend heavily on your system of choice. For example, most of the cross product implementation code you will find will be written for the right-hand system. You could easily write your own left-handed cross product function, but if you''re not too savvy with the math behind those operations, it''s a lot more difficult. Or you could ask in these forums Damn why did I say that

At any rate, it all depends on how you want to think about it. It also depends on the camera perspective your game will provide. The analogies saying that "x/y is screen, z is ''in/out''" are fine to think about, but once you start moving that camera around, just make sure you remember what analogy you''re using IMO, I would use the right-handed system because a lot of the math code they teach you in books is written for the right-handed system, and it''s widely used. Not saying the left-handed system isn''t. Hey, if the gamers can''t tell the difference, it doesn''t matter :D

Share this post


Link to post
Share on other sites
The choice of coordinate system often depends on where it is used. Animators may find it more natural to work with a Y-up coordinate system. Z-up coordinate systems are usually used when working against a ground plane.

Right-handed Z-up coordinate systems are widely used in popular software. For example in OpenGL Performer, Cosmo3D, OpenGL Optimizer, 3DStudio Max, Maya (supports Y-up) and others.

If one would use the term "depth buffer" instead of "z-buffer" one would be independent of the coordinate system used.

Share this post


Link to post
Share on other sites