3

I'm creating a .NET library which generates data for a 3D world, but it doesn't do any of the rendering itself. It falls on XNA, DirectX, OpenGL, etc to render it based on the data (the end coder does this). I want to provide the world data in a format which makes the most sense. In XNA, "Z" goes into-the-screen, "X" goes left-right, and "Y" goes up-down (based on my testing). I can deliver the world data in this same format, but I don't want to have it dependent on XNA. Is this the most common format for the axes orientation? I always visualize things as being "Z" as up-down and "Y" being into-the-screen, so I was going to deliver the world data in this format and just convert it in my XNA bootstrapper, but if no one else uses the data w/ that orientation, then it seems silly to deliver it like that.

Very grateful for any advice. Thank you.

Also, the world data is basically terrain data, so it has a logical structure for what should be up and down - mountains, etc.

CAbbott
  • 8,078
  • 4
  • 31
  • 38
Andrew Lundgren
  • 1,134
  • 1
  • 12
  • 18
  • 1
    In 2D, x is often horizontal and y vertical; you can see how XNA made its choice. However, I don't pretend to know much about it. – Marc Gravell Dec 05 '11 at 18:49
  • Thanks so much for the answers. Based on what you've posted, it sounds as though whether left-handed or right-handed, "Y" is commonly visualized as "up", w/ "X" left-right, and "Z" being forward, which will give me the orientation I can use. I'm not actually doing any transformations etc in my library. It merely serves up 3D coordinates. Correct me if I'm saying something dumb -- it's a very plausible case. – Andrew Lundgren Dec 05 '11 at 19:06
  • @user850427 In right handed systems, +Z is typically "backwards" (if LH makes +Z forward). – Reed Copsey Dec 05 '11 at 20:22

2 Answers2

2

There is no "universal" coordinate system.

OpenGL has typically used right-handed by default. Direct3D has typically used left-handed coordinate systems by default. However, both can handle left or right handed coordinate systems. Even with this, however, there are various ways of translating the world coordinates into the view, and different systems use different conventions.

If you're making something that will be generating models, and want it to be used by any underlying system, it would likely make your library much more useful to be able to have a user-provided coordinate system, and build using it. Doing the transformations is relatively straightforward.

Reed Copsey
  • 554,122
  • 78
  • 1,158
  • 1,373
1

Yes, in video game programming, because DirectX was the most popular 3D library for a while, the left hand X to the right, Y to the top, Z forward was and is still the most common axis convention used.

However, be aware that XNA math classes have all switched to a right hand convention, so if you want to work in a left handed system, you will have to invert some results, such as cross products.

Coincoin
  • 27,880
  • 7
  • 55
  • 76