• nlgranger@lemmy.world
    link
    fedilink
    arrow-up
    13
    ·
    edit-2
    1 day ago

    As an engineer, Z up right handed is the only one that makes sense. All engineering follows this convention, motion sensors (example) or GPS topography will use that.

    Cameras calibrations also use right hand but typically rotated such that it’s X right, Y down, Z depth. That way, the projection formula give the pixels column, row and depth values.

    camera coordinate system

    • calcopiritus@lemmy.world
      link
      fedilink
      arrow-up
      18
      ·
      1 day ago

      IMO there’s no correct answer. It depends on the purpose.

      Intuitively XY forms the plane where things are and Z is used for the “additional dimension”. Since first we think of 2D, and then we move to 3D, so it’s the natural way we think.

      So if you make a cities skylines type 2D game, the XY plane will form the ground. Which means that when you want to make the game 3D, Z means up.

      But if you’re making a platformer game (like old marios), you have XY being the left-up plane, like when drawing a graph in a paper. Then if you want make your game 3D (as in, having 3D models for assets, the movement would still be the same 2D). Then the Z will be forwards.

      Sometimes, even Y being down makes sense. Like with UI programming. This is specially important for window resizing. When you resize the window, you want everything to look roughly the same, but with more space. That is easier if you use (0,0) in a point that doesn’t move when resizing, like the top-left corner. Since the bottom-left corner moves if you make the window taller.

      • dejected_warp_core@lemmy.world
        link
        fedilink
        arrow-up
        8
        ·
        1 day ago

        I think the preference for Y being the vertical axis in gaming, comes from a legacy of orienting the work around screen-space (roughly 50 years ago). It was more efficient to have a memory layout that is easier to supply data to generate a TV signal. Since a CRT raster goes from upper-left to lower-right, line-by-line, that became the standard for screen-space: inverted y. So screen memory (or however the screen is represented in RAM) starts at address/offset zero, and increments from there. All the other features like hardware sprites, used the same convention since it was faster and simpler to do (easier math).

        When consumer 3D cards were relatively new, this was inherited, most notably when the hardware started to ship with “z-buffer” support. Carrying all this baggage into 3D engines just made sense, since there was never any confusion about the screen-orientation of it all. Why bother flipping axes around from world and camera space to the screen?

    • soulsource@discuss.tchncs.de
      link
      fedilink
      English
      arrow-up
      7
      ·
      1 day ago

      In Physics we mostly used right-hand, but X-right, Y-up, and Z pointing towards the viewer.

      But that’s details. The only important choice is between left- and right-handed, as that affects the signs in the cross product (and some other formulas - generally everything that cares about which rotation is considered positive).

  • flatlined@lemmy.dbzer0.com
    link
    fedilink
    arrow-up
    4
    ·
    edit-2
    1 day ago

    Hah, reading this not too long after watching Freya Holmer’s latest video/talk is fun. “Everybody is disagreeing, except everyone is agreeing that unreal is wrong”. The image is by her (it’s also used in the presentation). And she mentioned wanting to make it easier/possible to change handedness. She’d already had an ‘apology’ from Sweeny for the Unreal configuration. Interesting to see they’re taking it further than that.

    • usernamewastaken@lemmy.world
      link
      fedilink
      arrow-up
      9
      ·
      edit-2
      1 day ago

      tbh at this point most people taking a linalg class or getting into game programming are probably very familiar with the minecraft coordinate system

      similarly to how minecraft has taught an entire generation basic english

  • egerlach@lemmy.ca
    link
    fedilink
    English
    arrow-up
    9
    ·
    3 days ago

    Okay, am I understanding this correctly? In Y-up right-hand, positive X is “to the left”?

    I personally think that right-hand Z-up makes the most sense, but it makes sense to move to where most of the industry is going.

    • AnarchistArtificer@lemmy.world
      link
      fedilink
      English
      arrow-up
      2
      ·
      2 days ago

      I don’t think that’s correct. Here’s a drawing I did when trying to get my head around this.

      drawing

      I find that trying to make sense of terms like “to the left” tricky when we can rotate the directional cube any way we want. For example, in my drawing for “Y-up, left handed”, the red X axis is pointed leftwards. However, we could rotate the unit vector cube so that the X axis is pointed right, and the Y axis is pointing up (i.e. the orientation we’re most familiar with for 2D graphs). The Z axis would then be pointing away from us, into the plane of the paper/screen.

      In contrast, if we oriented the Y-up right-handed cube in the same way, then the Z axis would be oriented as if to come out of the plane of the screen/page, towards us.

      These distinctions only matter when we add a third dimension, so the left or right handedness is basically a question of "when we add the third axis to a 2D square made by the other two axes, does the third axis come towards us or away from us? I apologise if this hasn’t made things any clearer — I am able to make things make sense by imagining the rotations in my head, but not everyone is able to visualise them like that.

    • Björn Tantau@swg-empire.de
      link
      fedilink
      arrow-up
      4
      ·
      2 days ago

      From the chart I would guess that in Y-up right-hand positive X is to the right. You look at the palm of your hand.

      That way when you develop a 2d platformer you would use a standard XY coordinate system. Switching to 3d would logically add the z axis as depth and not height. A movie is usually shot that way as well.

      Of course that analogy breaks down as soon as your base-game is top down. Like a city planer or so.

      Anyways, with standards it’s often best to just go with what most others do. So kudos to Unreal for not being stubborn.

      • Philippe23@lemmy.ca
        link
        fedilink
        English
        arrow-up
        1
        ·
        2 days ago

        He references “Left-Up-Forward”, so X is Left, Z is into the screen.

        2D is not a consideration, even if it’d be logical. (That’s where Left-handed Right-Up-Forward grows out of.)

    • drspod@lemmy.ml
      link
      fedilink
      arrow-up
      3
      ·
      2 days ago

      Okay, am I understanding this correctly? In Y-up right-hand, positive X is “to the left”?

      No, the x-axis is usually the only consistent one (it increases from left to right). With right handed coordinate systems you can have Z going into the screen (Y-down) or Z coming out of the screen (Y-up)

        • AnarchistArtificer@lemmy.world
          link
          fedilink
          English
          arrow-up
          2
          ·
          2 days ago

          I don’t think that’s right. The post that you linked to includes this link, which includes this snippet:

          "First, instead of labeling coordinate axes with X, Y and Z, we’re introducing more descriptive axis names:

          Left (was -Y)

          Up (was Z)

          Forward (was X) "

          • Philippe23@lemmy.ca
            link
            fedilink
            English
            arrow-up
            2
            ·
            edit-2
            2 days ago

            I don’t follow why that means I’m wrong.

            “Was” here refers to their old Z-Up, left-handed coordinates, where X was forward, Y was right, and Z was up.

            • AnarchistArtificer@lemmy.world
              link
              fedilink
              English
              arrow-up
              2
              ·
              2 days ago

              You’re right that I didn’t sufficiently consider the “was” in that sentence. Perhaps there’s something I’m missing though, because I haven’t seen anything that would suggest X is left. When I put my right hand in the position indicated in the OP, my index finger (Y) points upwards, with my thumb (X) pointing right, making an L shape. My middle finger (z) comes out towards me.

              However, most of my experience with coordinate systems is with abstract, mathsy stuff, and I don’t have much experience with any of these softwares; there may be something obvious that I’m missing.

              • Philippe23@lemmy.ca
                link
                fedilink
                English
                arrow-up
                1
                ·
                edit-2
                2 days ago

                You can spin your hand 180° around Y (index / up). Then Z (middle) points away from you, “forward”. And X (thumb) will point left.

                Thus the “Left-Up-Forward” + Right-handed.

    • Hadriscus@lemm.ee
      link
      fedilink
      arrow-up
      6
      ·
      edit-2
      1 day ago

      There were discussions recently about the feasability of changing Blender’s coordinate systems. The answer was that it was highly unlikely to happen because there was no single place where it was defined -instead, it was assumed throughout the code that Z was up, in probably tens of thousands of lines… and the work to regularize that would be gargantuan with no clear benefit -since exporters and importers are supposed to handle these transformations anyway.

    • ulterno@programming.dev
      link
      fedilink
      English
      arrow-up
      11
      ·
      2 days ago

      In case of Blender, I’d say, it could be user choice.
      But I like Z up right handed because it matches the convention used in high school physics.

      Rather, why don’t Y-up software change to Z-up, instead?
      Were they taught to use Y-up in Kinematics-3D? I doubt that.

        • ulterno@programming.dev
          link
          fedilink
          English
          arrow-up
          2
          ·
          edit-2
          22 hours ago

          Yes.
          And that’s why I once previously came up with an assumption that a game engine having Y-up as default, probably started as a 2D game engine

          I remember getting downvoted for that

      • RightHandOfIkaros@lemmy.world
        link
        fedilink
        English
        arrow-up
        6
        ·
        2 days ago

        Z-up is really only common among architectural or engineering type software. CAD and other types of software, for example.

        Y-up is common among basically all other types of software. DirectX API is Y-up, for example. Which means anything that interacts with DirectX that has Z-up needs to convert the axes first before doing its calculation (a literal nothing cost microoptimization, but could be big depending on the software and platform).

        It’s probably fine to leave as is in the long run, but its just annoying to me that I need to convert between the axes in Blender export settings, and would be more convenient if all the software I use used the same system, which is now Y-up. Blender is literally the only one. Honestly, I agree that it should be a user setting in Preferences, but I dont know if Blender is programmed to handle this or if it would need to be entirely rewritten.

        • ulterno@programming.dev
          link
          fedilink
          English
          arrow-up
          0
          arrow-down
          1
          ·
          21 hours ago

          Well, considering that Kinematics 3D [1] uses Z-up and the main reason for Y-up being the 2D monitor having been the primary target for graphics output (where X and Y would have been taken and mapped first, requiring Z to be added when converting the paradigm to 3D) back when these things were started and us, slowly transitioning to having the same application being usable with both - AR/VR tech and monitors[2], we might as well all go with Z-up from the start.


          1. an academic subject, which should supposedly be your first introduction to a 3 dimensional coordinate system after the pre-introduction back in Kinematics 2D and pre-pre-introduction when learning the number line. i.e. If the academic curriculum was sensible ↩︎

          2. which would mean that in some cases, the user might be seeing some axes-gimbal, requiring a translation layer later anyway and in this case on the application developer’s side, which makes it a cognitive load ↩︎

    • Cricket [he/him]@lemmy.zip
      link
      fedilink
      English
      arrow-up
      2
      ·
      edit-2
      3 days ago

      I haven’t used Blender in a long time, but the graph in the OP says it’s Z-up?

      Edit: never mind, I misunderstood what you wrote!

    • TheFogan@programming.dev
      link
      fedilink
      arrow-up
      14
      ·
      3 days ago

      Haven’t really done much in game design, but if I’m understanding right.

      In game design, lets go with 2d first. You mark position with numbers. In 2d you have X and Y. So you say to move to 5,5. then from the starting point that will be 5 right, and 5 up.

      3D you have the same thing, but a bunch of different groups were working on it in different ways without working together. So you wound up multiple systems that had X, Y and Z meaning different things. In the majority of 3d systems Y represents up/down. (the other 2 directions are still kind of half and half between systems)

    • IrateAnteater@sh.itjust.works
      link
      fedilink
      arrow-up
      72
      arrow-down
      1
      ·
      3 days ago

      Because a flat surface is an x-y plane. The ground is a “flat” surface, and so the z dimension is height.

      For me, that’s the only way that makes sense. But I program robots for a living, so I’m used to dealing with coordinate systems where the flat reference is the ground. Programmers seem to be using the screen as the flat reference. If I were building a game world, I’d probably use z-up convention.

      • theunknownmuncher@lemmy.world
        link
        fedilink
        arrow-up
        11
        arrow-down
        1
        ·
        edit-2
        3 days ago

        Programmers seem to be using the screen as the flat reference.

        In screen coordinates, the origin is the top left corner of the screen, and the Y-axis increases towards the bottom of the screen. So Y still isn’t “up”

        • Redex@lemmy.world
          link
          fedilink
          arrow-up
          2
          ·
          2 days ago

          His point is that’s where it comes from. In most 3D software as seen in the chart, the XY plane is paralel to the screen, just that Y is up instead of down like in 2D, cut that would be insane if it was like that.

      • popcar2@programming.dev
        link
        fedilink
        arrow-up
        7
        arrow-down
        2
        ·
        edit-2
        3 days ago

        Yeah, it depends on whether you expect the 2D view to be on the floor or on the wall. If it’s on the floor, Z is up. If it’s on the wall, Z is forwards & backwards (depth). Personally I think it being on the wall makes way more sense since we already expect from 2D view that Y is up and down, it feels weird to shift it to forwards & backwards when switching to 3D.

      • RedSnt 👓♂️🖥️@feddit.dk
        link
        fedilink
        arrow-up
        10
        arrow-down
        6
        ·
        3 days ago

        Every kid learning math has to at the very least learn X and Y coordinates for graphs. That’s the reason I think Y is the natural up, it just makes more sense to be in line with what everyone already know instead of flipping it around.

        • theunknownmuncher@lemmy.world
          link
          fedilink
          arrow-up
          32
          arrow-down
          1
          ·
          edit-2
          3 days ago

          You looked down at the math book on your desk that showed the X-Y graph on the page, and the Y axis extended forward, away from you. Z was “up”.

          • dormedas@lemmy.dormedas.com
            link
            fedilink
            arrow-up
            23
            arrow-down
            1
            ·
            3 days ago

            I always thought about it like this. Put your fancy page with X-Y coordinates on the ground. Add a new dimension perpendicular to the ground. This is the Z-axis, it goes up.

            • Grey Cat@lemmy.world
              link
              fedilink
              English
              arrow-up
              1
              ·
              2 days ago

              But in those cases, isn’t positive Z going “away” from you ? I.e. Into the ground ?

              And in math classes this has always been described to me as adding “depth”.

              • dormedas@lemmy.dormedas.com
                link
                fedilink
                arrow-up
                1
                ·
                1 day ago

                I could see that being totally valid after thinking about it for a second!

                I imagine it as a new dimension growing “up” out of the X/Y plane (as burrowing into the ground would be going into “occupied” space, it’s forbidden). But “depth” does make that make more sense.

        • CookieOfFortune@lemmy.world
          link
          fedilink
          arrow-up
          5
          ·
          3 days ago

          Imagine you’re drawing a level or a city or a landscape. Wouldn’t you want to work in X and Y for this? Precisely because you’ve learned the X and Y coordinates in school. Then you add Z as the height.

          • RedSnt 👓♂️🖥️@feddit.dk
            link
            fedilink
            arrow-up
            2
            ·
            2 days ago

            Yeah, for cases like maps it works, but most everyone that draws don’t do bird eye view drawings. I’m just saying, I think it’s more natural for people to draw scenes on 2D planes, and converting that to 3D Z as “depth” makes more sense. Although all the reasons I’ve heard for Z as height also makes sense to me now.

        • moonlight@fedia.io
          link
          fedilink
          arrow-up
          13
          arrow-down
          3
          ·
          3 days ago

          I disagree – I think Z up is much more natural in this sense. X,Y is a plane, and it’s much more natural to think of a plane as being horizontal, especially in a 3D environment with a ground plane. Z is the third dimension, perpendicular to that plane. Think about it this way, doesn’t it makes way more sense to have a map with X,Y coordinates rather than X, Z coordinates?

          • offspec@lemmy.world
            link
            fedilink
            arrow-up
            2
            ·
            2 days ago

            I feel like whiteboards have gone extinct or something. All of my math lectures from grade school to uni took place on a y-up surface. I can appreciate that there are multiple ways to skin a cat, but I feel like people just argue what’s most convenient for their preference in this kind of situation.

            • Redex@lemmy.world
              link
              fedilink
              arrow-up
              1
              ·
              2 days ago

              Yeah you’d draw it on a vertical whiteboard, but in physics and math (or at least all the classes I had), you’d always draw a coordinate system with Z going up. I can understand why it would make sense for you to look at XY being a vertical plane, but I feel like it just makes more sense for XY to be the ground.

              Also, convenience wise, especially in e.g. game dev, for 90% of use cases it’s way more convenient for the first two coordinates to be the ground position and the last coordinate be the height. Whenever you’re thinking of the coordinates of something, you’d probably first think about its ground position and then its height, in which case it’s much simpler if those ground coords are at the start, instead of at the beginning and end of a vector.

          • lb_o@lemmy.world
            link
            fedilink
            arrow-up
            8
            ·
            edit-2
            3 days ago

            Fully agree with you.

            Y-up doesn’t make sense in gamedevelopment at all. All those changes, because some dinosaurs of the past decided that Z is their screen depth.

            And what should we do with all previously released games? Refactor all vectors?