29
\$\begingroup\$

I learned at school that the z-axis is up. It is the same in modeling software like Blender. However in many games the y-axis is up.

What is the reason?

\$\endgroup\$
5
  • 2
    \$\begingroup\$ Actually, over here in university many people draw y in up-direction when they draw a 2D image (guess because in 2D y is also up and often we just use 3D as a generalization of 2D when showing examples). Cannot remember we really learnt a rule for it in school. \$\endgroup\$ Commented Dec 25, 2012 at 21:32
  • 10
    \$\begingroup\$ Simple answer: for millions of years mathematicians drew XY graphs on paper which has X going left-right and Y going up-down, and when depth was added it became Z going in-out of the paper. Not so simple answer: no one agrees on anything, why would they agree on arbitrary axes? =) \$\endgroup\$ Commented Dec 26, 2012 at 0:27
  • 2
    \$\begingroup\$ See also: gamedev.stackexchange.com/questions/13414/… \$\endgroup\$
    – Kylotan
    Commented Dec 27, 2012 at 14:46
  • \$\begingroup\$ I find this counter intuitive for 2D too, perhaps because I started out with XNA where Y goes down. But things should at the back should be drawn first and higher up in screen space often means further away. This results in flipping some y's when drawing tilemaps and the logic becomes awkward. \$\endgroup\$
    – Madmenyo
    Commented Apr 7, 2015 at 17:12
  • \$\begingroup\$ Notice that if we originally worked with ZY graphs with Z in the up, then we wouldn't have this issue - we would have just introduced an X-axis and be done with it. (Or, similarly, if we added a W axis to our YX graphs, we would also not have this confusion.) \$\endgroup\$ Commented Sep 30, 2017 at 16:58

5 Answers 5

60
\$\begingroup\$

I think the direction of the coordinate axes are holdovers from different domains where the crucial plane was different, and X/Y were aligned with that crucial plane. In some applications the ground plane was the most important, thus X/Y were the ground and Z ended up perpendicular to that. For games however the crucial plane is usually the screen (especially of course back when they were 2D and just starting to transition to 3D) thus X/Y were the screen and then when games went 3D Z ended up perpendicular to that.

You can see that kind of distinction between the two biggest 3D art tools: 3ds max and Maya. The Z axis is up in 3ds max because that grew out of architectural tools, while the Y axis is up in Maya because that grew out of movie-making tools.

The important thing to realize when comparing any specific tool to what you learned in school is that it's all arbitrary. It really doesn't matter which way the axes are pointed as long as you keep everything consistent and translate correctly between different coordinate systems.

EDIT: relevant tweet from Tim Sweeney lol https://twitter.com/timsweeneyepic/status/952661474501111808

\$\endgroup\$
0
6
\$\begingroup\$

As far as I have ever gleaned the Y = up/down, and Z = depth is based off of physics where gravity is always in the (-Y) direction, and then adding 3D means you don't want to change a fundamental, so it was made depth.

On the Z = up/down method though that is a throw back to mathematicians. because X/Y was drawn on the paper that was flat on the table when the Z-axis was extended it was coming up out of the paper, and therefore up. though many of your engineers will also use this convention as well.

in regards to the convention used by the given tool: Maya, and Unity have Y-up (probably designed by someone with a physics background). while 3DsMax, and Unreal have Z-up (probably designed by mathematicians/engineers). though it can also be said that these could also be just a split decision made one day because a consistent system had to be used.

since this question focuses on a modelling tool, and is placed on a gamedevelopment Q&A site. you might want to look into what coordinate system you will be exporting to, and make sure that you conform to that.

also realize that some system the axis system is hard set, and permanent, and others it can be modified (think it can be changed in Blender and Unreal, but might be mistaken)

\$\endgroup\$
3
\$\begingroup\$

It's mostly legacy from the times when all that could've been made with 3D was some screen-space rotating cube or parallax scrolling or something similar. In such applications, Z was "depth" because X and Y were the axes for the screen plane. As demos were getting more advanced, the original conventions stayed because it's easier not to change anything that works.

As for why exactly today's games have Y as the vertical axis - there are lots of poorly written tutorials out there that do not explain the difference. Usually it's most useful to have the primary movement plane on X and Y axes (so that most 2D calculations don't require swapping axes in code). For most sidescrollers, it is quite naturally coincident to the screen plane (X/Y). For adventure games and such, X/Y works nice as the horizontal plane (perpendicular to direction of gravity) because it maps perfectly to in-game maps, gamepad controls, terrain heightmaps and many other things.

\$\endgroup\$
2
\$\begingroup\$

Because the coordinate system that are used in games are based off of the dimension of the monitor. When computer renders anything, it starts at the upper left hand corner which gives the x, and y coordinate of [ 0, 0 ]. As the rendering progresses towards the right side of the screen, the x value increments, respectively when the render moves down, the y value increments. The coordinate system is basically that of a 2D space, except the origin rest on the upper left hand corner and not the center of your screen.

In 3D packages such as 3DsMax and Maya, they have their own definition of x and y coordinates based on what is is important to them. 3DsMax was based off architectural design, if you draw a schematic on a 2D plane, y is up. In Maya, which is mainly use for animation therefore the ground is x, y and the height is z.

\$\endgroup\$
3
  • \$\begingroup\$ In Maya the screen is X/Y and Z is perpendicular to the screen. \$\endgroup\$
    – jhocking
    Commented Dec 27, 2012 at 13:07
  • \$\begingroup\$ Downvoted, because the question is "Why" not "How", it lacks the reasons as to why it is as it is, just reiterating how it is. \$\endgroup\$ Commented Dec 27, 2012 at 13:21
  • 1
    \$\begingroup\$ Well in fairness the first word is "because" ie. this answer starts with an explanation of reasons. Maybe it's not a great explanation, but it is an explanation. \$\endgroup\$
    – jhocking
    Commented Dec 27, 2012 at 16:32
-5
\$\begingroup\$

in all truth Frankie Law and snake4 gave the correct answer together if you think about it. The monitor itself is already in the xz plane not the xy plane. However, 2d started programming it all as xy, even though the correct direction would have been xz, unless your monitor is sitting flat on the ground, facing up, and your looking straight down at it, from directly above it. In which case it would be correct.

to clarify for those who need it: xyz has existed in physics and math longer than 3d graphics. And as 2d graphics started they only used two dimensions with no intention of adding a third at that time, so x and y. By the time a third dimension was added, simply adding it as the missing dimension was easier than rewriting years of work to put x, y, and z in their proper perspectives. So now we have two definitions that will never agree: on the one hand z is depth, or distance forward/backword, on the other z is altitude or up/down.

To complicate it even more for game development, before 3d graphics, in "top-down" games it was still x and y on the screen where y was not used as up, in 2d by "side scrollers" it was still x and y and here y was clearly used as up. So for game development which is height or depth depends on perspective.

\$\endgroup\$
4
  • \$\begingroup\$ "even though the correct direction would have been xz" perhaps you can clarify on the - why is the correct direction would have been XZ exactly? \$\endgroup\$
    – Kromster
    Commented Jan 30 at 10:47
  • \$\begingroup\$ "The monitor itself is already in the xz plane" \$\endgroup\$
    – quintazon
    Commented Jan 30 at 11:11
  • \$\begingroup\$ Well, that's a bold claim supported by nothing xD. Take Word processors, there the work is done on the virtual sheet of A4 paper, left-to-right, top-to-bottom - feels pretty much like XY coords. Same for CAD (and drawing boards that CAD systems emulate). \$\endgroup\$
    – Kromster
    Commented Jan 30 at 14:15
  • \$\begingroup\$ feels like another perspective. So lets do it by virtual: you build a virtual monitor who's coordinates for its display screen happen to land on [0,0,0] for one corner and [800,0,400] for the second. now someone tries to put something in that screen using [0,0,0] [800,400,0] and all points between to display the pixels. you would end up with nothing on the screen without flipping it up first. Possible and is done, but makes less logical sense, that is my point, but it is not the point of the answer. your off topic. \$\endgroup\$
    – quintazon
    Commented Jan 30 at 15:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .