Right handed coordinate system... why?

Started by
26 comments, last by Raghar 17 years, 7 months ago
Right handed coordinates make a lot of sense when Z is up. (Think of a piece of graph paper with 2D cartesian coords on it which is now being augmented with a third dimension.) This is how most people do math and physics.

When you spin it around so Z is into the screen and Y is up, then it's just weird. When you become OpenGL and screw up the matrices so that they don't even match the coordinate system, then it becomes retarded and non intuitive.

So the conventional way right handed coordinates are placed on the screen is kind of odd, but OpenGL goes and makes things much worse.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Advertisement
Quote:Original post by Promit
When you become OpenGL and screw up the matrices so that they don't even match the coordinate system, then it becomes retarded and non intuitive.
What exactly do you mean by OpenGL matrices not matching the coordinate system? Just curious...
I have always been bothered that Y is traditionally used as up. The most intuitive coordinate system (to me) for a 3D space is to assume that the "default" view is top-down, where 0,0 is bottom right. This means in 2D you have a standard quadrant 1 view, with positive Z as up.

A top down view just seems right for visualizing the world. When Y is up it seems as if you are thinking in side-view... but in 3D, which "side" is it?

Check out my new game Smash and Dash at:

http://www.smashanddashgame.com/


Again we have this fundamental discussion of different coordinate systems. I find it rather limited not to understand the existence of different systems.

I have to admit that I am z-up person and it suits me well since all the CAD systems are like that too.

Occasionally I consider the space where it doesn't make sense to fix things into one coordinate system. Any location on a planet can has a different local coordinate system, otherwise it becomes just too weird.

It isn't right, it isn't wrong ... it is just different.

Cheers !
Quote:Original post by jyk
Quote:Original post by Promit
When you become OpenGL and screw up the matrices so that they don't even match the coordinate system, then it becomes retarded and non intuitive.
What exactly do you mean by OpenGL matrices not matching the coordinate system? Just curious...
The most intuitive way to visualize a transformation matrix is to consider each row/column as one axis of the object's local coordinate system. The first column (in the case of OGL) is the local right vector, the second is the local up vector, the third is the local look vector, and the fourth is of course the world space position. You can compose a desired transformation very easily using this logic, without having to muck about with all sorts of formulas.

In the case of the identity matrix, that means that right is (1, 0, 0), up is (0, 1, 0), and look is (0, 0, 1). Makes sense.

The problem is introduced because in OpenGL, the default transform has things looking down negative Z. That is, the identity matrix specifies that the object is configured so that right is (1, 0, 0), up is (0, 1, 0), and look is (0, 0, -1). The entire coordinate system has been deliberately reflected around the XY plane. You end up reflecting everything back every time you want to construct a transformation matrix from the vectors defining the object's coordinate space. Maybe I'm overreacting, but that really gets on my nerves. (And I think you can actually repair this damage with a specially configured perspective matrix, but I forget.)
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Quote:Original post by Promit
Maybe I'm overreacting, but that really gets on my nerves. (And I think you can actually repair this damage with a specially configured perspective matrix, but I forget.)
Ah, I see. I just wasn't sure what you meant. Personally when using OpenGL I treat +z as forward for the purposes of my application, and just apply a 180-degree flip as the very last step before computing the view matrix and sending it off to OpenGL. This is wrapped up in a camera class, so it's not something I think about often.

Also, given that you can upload your own projection and view matrices it may be that you can just as easily 'configure' OpenGL to be left handed, as you mentioned. I haven't actually tried this, but it would be a useful thing to confirm (or otherwise).
Quote:Original post by Redburn
That totally doesn't make sense to me.


It doesn't make sense because it's not a decision of logic, it's just a convention.

Just like nature couldn't decide for left handed people vs right handed people, why scripture is left to right or right to left or top to bottom or bottom to top or in diagonal. Why there is antimatter and matter (though antimatter tends to be short lived on earth).

What you need to realize is that in the end it doesn't make a difference: just be aware of the differences, plan your matrices of transformation accordingly and don't assume that everybody "naturally" thinks the same way as you do. As long as it's documented, then it's not a big deal.

LeGreg
I think that skizz has hit the nail on the head.

There are two predominant methods of defining things.

One is in regards to 'what one expects' - All the posts but skizz are defining the coordinate system using the 'what I expect' method.

The other is in regards to actual implimentation details. VRAM addressing as skizz mentions is only one example where it can be advantageous to prefer one over another presuming that you have a preference axis for that implimentation. Another could be in vertex transformations. If Z is the first coordinate ready for pre- and/or post-transform work, then you probably want 1D, 2D, and 3D methodology to all favor the use of this fact.
Quote:Original post by Rockoon1
The other is in regards to actual implimentation details. VRAM addressing as skizz mentions is only one example where it can be advantageous to prefer one over another presuming that you have a preference axis for that implimentation. Another could be in vertex transformations. If Z is the first coordinate ready for pre- and/or post-transform work, then you probably want 1D, 2D, and 3D methodology to all favor the use of this fact.
Problem is, none of that is even vaguely relevant to how graphics hardware actually works.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Quote:Original post by Promit
Problem is, none of that is even vaguely relevant to how graphics hardware actually works.


Problem is, you are assuming.

The OP did not state anything about hardware, nor anything about graphics for that matter. He is quite non-specific in the original post and in his follow up post he mentioned XNA which is a complete API for game production so the major considerations arent just graphics or video hardware related.

Clearly Microsoft needs to also consider the CPU end of things and we don't know what their conclusions were. We do know that they chose a right handed coordinate system and we also know that specific coordinate systems can be advantageous under some circumstances. Those circumstances if they are present are not arbitrary while your pet favorite coordinate system *IS* arbitrary.

Coordinate systems arent just for graphics.

But what the hell do I know?

(edited to add an 's')

This topic is closed to new replies.

Advertisement