Download

Z-Up vs Y-Up, the solution to the debate lies within...

Saw an interesting post in the UE4 Facebook group today that made me enquire a little more into the Z-Up nature of Unreal Engine. I know when the engine went free there was a lot of (fruitless) debate about whether UE or insert other random engine here got it ‘right’ or ‘wrong’. Asked a few questions and did a bit of reading, so here’s what I found out and perhaps it’ll settle the debate :wink: This isn’t to start a flame war, but I honestly just found it interesting and figured some folks around here would too.


The tale starts with 3DS Max. Released in 1990, it’s designed and used primarily for architectural purposes. In Architecture, you typically start with your floor plan which would be plotted on a 2D grid first, X and Y. When it comes to extruding that up into a 3D model, you need the next dimension (Z) to be up. That fellow devs, is apparently why Z is up in 3DS Max. Makes perfect sense for it to be that way.

In 1998 Maya is released primarily as an animation package. Animation at the time was typically in 2D, from the side-on. Think early Disney and other old animated titles done from a side-on perspective (like a 2D platformer). You start working in X and Y, and your new dimension Z becomes the depth. That would also explain why Maya is Y-Up.

3DS Max was the modelling package of choice for most developers at the time, and as Unreal came out before Maya (and it’s crazy ideas) - Unreal was done in Z-Up to match.


As an afterthought, it does make more sense (at least to me) for a Games Engine to be Z-Up - especially in 3D. If you’re working on any 3D title, you typically plan your levels from the top-down, not from the side-on. You box them out in X and Y first then proceed to the next logical dimension Z, which would be Up.

Perhaps Tim can come here and enlighten us further, but honestly I think this about covers it. The dilemma is solved forever! :wink:

3D co-ordinate systems have been around for eons longer than Maya / Max with Z typically always up…
Curious to know what CryEngine uses because Unity matches Maya. Did Unity start life as a 2D engine?

It’s all about whether you are thinking in screen space, or in world space.

In screen space, Z as depth makes sense given X and Y screen coords - this is why a lot of rendering techniques have names like the ‘Z buffer’. This is also acceptable for most 2d games since the camera perspective is effectively immutable.

In world space, you generally want to build worlds like you would real world objects - and any good schematic treats the third coordinate as vertical. It makes sense to do it this way; if you were to define a rectangle in world space, you give it’s width, breath, and then it’s height. If you treat Y as vertical, you’re hanging on to an anachronism that assumes the camera is still immutable* in order to make Z stay as depth - which doesn’t play right with conventional thinking - and that conventional thinking has been around for centuries.

*technically speaking, this is often sort of the case in renderers, that the world is orientated around the camera, but thinking about thing this way just isn’t practical when it comes to implementing them on top of the renderer, so we assume the camera moves through static coordinates, making much more sense to the user.

Z-up makes more logical sense in three-dimensional games, but Y-up makes more sense in two-dimensional games.
At the same time though, Y is up in MOST modeling packages. That being the case, it’s much better for Y to also be up in a game engine. This coming from someone who personally prefers Z-up.
Although, like I said Z–up is more logical, and it’s way easier to make a modeling package stop being retarded and use Z-up than to do the same with a full-blown game engine.

Most programs give a choice now, but I think it should still be Z up. I believe that’s mathematically correct as well

I never realized people had such issues with this stuff hahaha.

because Z up i always have problem with downloaded free rigged models. this models always for Y up, for example when i first create vehicle in maya i skin it for Y up but in final i MUST be reskin(from scratch) to z

There are two fairly reasonable ways to define a coordinate system for a 3D environment. Both build on the intuition we learned in school with graph paper, with X representing the horizontal coordinate, and Y the vertical coordinate.

If you think of the world from an overhead perspective (like Google Maps), then the location of an object on the map is defined primarily by its X and Y coordinates, and its height above the map by Z. In my intuition, this was the most sensible coordinate system for Unreal. This standard was earlier chosen by AutoCAD deriving 3D data from 2D floor plans, and continued with Autodesk’s 3D Studio.

If you think of the world from the perspective of the screen, then X is right, Y is up, and Z is forward. If you further assume you’re level and facing north, then that defines the other popular coordinate system. Historically, its use derives from OpenGL, which was derived from SGI’s IRIS GL, and is logical if you’re mapping a default observer in a 3D world into screenspace. Maya was initially developed for SGI hardware, so it took this path too.

Most computer graphics literature use Z forward instead of Z up.

OpenGL is right hand system, which means going forward is -Z, is a bit annoying when you combine with other parts of the engine. DirectX is left hand, which is more “correct”. Anyway, it’s good to stick with one convention, unlike some other engines like Gamebryo, which uses different coordinate systems depending on which layer u are using

I would love it if there was a way to abstract away which letter is ‘UP’. I know that would be a technically challenging thing to do with so many parts of the engine hard coded to assume that the third value of a vector is up. It would probably involve having a Vector3 data type that had an UP property that you could change to Z or Y and would do some internal swizzling. It could even hurt performance if that was the case. But an editor setting would be nice.

Maybe we could have a poll and vote on it. I’m in the Y camp because I’m a maya guy.

That’s probably because graphics wise, you’re talking about screenspace. At which point, it makes sense for Z to be forward (aka, away from the screen).

Unreal-ated (heh) - but that’s an awesome showreel in your sig! I figure changing the coordinate system now would only cause more issues than it would solve. Since the FBX exporter has a checkbox to swizzle coordinates anyway, it probably doesn’t matter too much anymore.


Thanks for the input on this btw Tim, if nothing else it’s interesting trivia behind the engine!

Same, been using maya for years and can just change it when needed… no really big deal about it :).

FPS-Y doesn’t sound nearly as good as FPS-Z (eg. Tribes)

Also note that the ‘Y’ axis is used to denote looking up and down in 3D games, and of course, we have the Z buffer, which deals with depth.

It’s a shame that Epic don’t give you the choice when setting up a project.

This isn’t really correct. Looking up and down is pitch, and corresponds with a rotation around the Y-axis in classical mechanics (and also in most games, as well as the Unreal Engine). You’re sort of looking up and down the Z-axis as a result, but it doesn’t really make any sense to think about it this way because it’s a rotation, not a translation.

Yaw is a rotation around the Z-axis and Roll as a rotation around the X-axis.

The Z-buffer deals with depth because as mentioned before, it is with regard to screen space, not game space. These are two different concepts and the coordinate systems are not the same.

I think the bottom line is that both coordinate systems make sense in their own ways, and are equal in terms of pros and cons or making sense and not making sense, you just have to go with the developer decision!

Cheers, helpful info.

While this is not really adding to the discussion;
I always remember @ school, where I used to be confused as to which axis went with which letter, One teacher told me that X is across and then smiled.

I just sat there and thought that’s not going to help, I’ll still confuse them.

Then the dawn came, across A cross. oh, right. :slight_smile:

Thank you so much understanding the why is just as important as how.

All industries prior to 3d animation computer systems have always considered Z-up.
I started to learn 3d for the first time with Maya in 2001, so deep in my head everything should be Y-up and I hated 3DS Max because of that, but we can easily set Maya to be Z-up too.