stride3d / stride

Stride Game Engine (formerly Xenko)
https://stride3d.net
MIT License
6.46k stars 934 forks source link

[FR] Left handed coordinate #1607

Open Thaina opened 1 year ago

Thaina commented 1 year ago

Is your feature request related to a problem? Please describe. I wish I could use game engine in left handed coordinate system. And so if possible I would like to have this engine can switch between coordinate as an argument or compiler macro, or have separate branch

Describe the solution you'd like Ideally it should be setting in the project and can set as default setting in machine when installing

Describe alternatives you've considered Maybe just have compiler directive that allow us to recompile this codebase into another coordinate

Thaina commented 1 year ago

Since unity migration would com along the way, I would suggest this feature should be prioritized

NicusorN5 commented 1 year ago

I think that's just bikeshedding.

Fydar commented 3 months ago

A comparison of software across the industry from Freya Holmér.

image

I am a Unity user myself so I have come from a left-handed Y-up engine. I don't think it's feasible to make it something that can be toggled.

The reason I think right-handed is better is for support for 2D games. When a number is greater, it is closer to the camera, this rendering in front of other objects.

Thaina commented 3 months ago

@Fydar Please allow me to quote myself

Z-Up is the only sensible axis for right handed coordinate

It was totally make sense when you think about history. Architects and Mathematics are working on table, flat plane, etc. And so X is right and Y is up and away. And when they need to go another dimension, only Z is available up from the table

But when we work on vertical plane, displaying anything, since the blackboard. They need to draw X/Y in the same way on the ground. However there are no advantage of piling up something anymore, so Z dimension is intuitively forward into the screen

In essence, the positive axis always stay the same Vertical is up, Horizonal is right, Depth is forward. RH or LH was start from the question, which plane do you start with for X Y

The whole abomination of negative Z forward, negative X right (GLTF), and so on. Is the fault that they now work only with screen but still try to force RH coordinate, since the OpenGL. And they just hack it by flipping clip plane because they just stubbornly try to amend with RH coordinate, which is not natural for monitor screen

And it was propagated into industry standard which make everything awkward with no good reason

I like to compare choosing RH Coordinate is like choosing Imperial Unit instead of SI unit. It's just convention to choose imperial, SI was actually better because it consistence in scaling

For the reason of 2D I think opposite. Because even 2D game we actually made things in 3 dimension. So side scroll game better be used LH, so that background is positively far away and the main layer maybe 1 unit in from of camera, or set it base on real meter from camera

If we really want to pile things up, most likely that is a top down game. Which is only the sensible scenario of RH coordinate

LH Coordinate also a UI Coordinate. When you want to pile things up with Z coordinate you can make Y-down and it become another configuration of LH that sensible for reading up to down, (0,0) is topleft corner