#1 Members - Reputation: 546
Posted 21 July 2012 - 08:27 PM
I am having a problem with a discrepancy between a set of 3D models which I have purchased and the OpenGL coordinate system. All of the models were exported with the Z axis pointing up, while OpenGL by default has the Y axis pointing up. The way I see it there are two options:
1) Modify the OpenGL coordinate system so that the Z axis points up
2) Modify the 3D models so that the Y axis points up
Neither task sounds like fun (option 1 forces me to modify the way OpenGL works by default, which I take no pleasure in doing, option 2 forces me to use a program like Maya, which I know absolutely nothing about). I'm just trying to get a sense of what is more commonplace in the game industry. Is it up to the programming team to make the coordinate system match the 3D models, or is it on the art team to make sure that the 3D models come in the proper coordinate system? Additionally, which of the 2 possibilities is the recommended path to take?
Thanks,
-Adam
#2 Members - Reputation: 747
Posted 21 July 2012 - 09:04 PM
There are many places where you can solve it. Flag it on export if you can. Flag it on the model when loading. Manually rotate the object before exporting. I wouldnt mess with opengl, Id rather tweak the data. I do it this way because it doesnt have an impact on animations, its just an additional transform at the root so that objects are not on their side (or face down on floor). Overall its just a pain.
I think maya is Y up by default but can be changed, Max doesnt allow it to be changed, in case you do import into Maya, initially you might have the same problem as with opengl.
#3 Members - Reputation: 546
Posted 21 July 2012 - 09:11 PM
#4 Members - Reputation: 747
Posted 21 July 2012 - 10:12 PM
If you have models already made and dont want to or cant re-export, then the simplest way would be to rotate them in code by manipulating the objects world matrix that gets used for rendering. If you have some sort of scene graph like transform hierarchy, you can just apply the transforms i mentioned to the objects local transform then when you calculate the objects world transform for rendering it will draw correctly.
If you decide to re-export, apply the appropriate transforms at the end just before exporting. Which might mean (in the case of 3DS max) rotating the object to be face down (or up or whatever) just before exporting. I doubt anyone working on the models would want to build objects on their side, so do the flip at the end before exporting once the models done.
Which ever way you do it is gonna produce the same result, if you do and 90 degree correction in Max/Maya just before export using the rotate widget after selecting the object, the underlying operation is the same 90 degree rotation you'd be doing in code on the objects local transform.
#5 Members - Reputation: 1382
Posted 27 July 2012 - 04:42 AM
OpenGL does not specify a default up axis. It depends soley on your camera transform.All of the models were exported with the Z axis pointing up, while OpenGL by default has the Y axis pointing up.
Is it up to the programming team to make the coordinate system match the 3D models, or is it on the art team to make sure that the 3D models come in the proper coordinate system? Additionally, which of the 2 possibilities is the recommended path to take?
Both. The artists need to make sure they model things the correct way up, however the programmers should make sure that they can transform geometry. We are just talking about a 90 degree rotation around X here, so assuming you have a matrix transform for each mesh, it's not actually a problem. Mind you, writing a tool to rotate some vertices & normals in your files, is something that should only take you a couple of minutes.
Because the changing the up axis in the 3ds max properties is too hard?I added the Y up functionality because Max +Z is up,
Again, you can use any up axis you want. This is not a limitation of OpenGL.Neither task sounds like fun (option 1 forces me to modify the way OpenGL works by default, which I take no pleasure in doing,
No it doesn't. It means you need to use some trivial matrix maths. Using Maya/Max et al, is just over-complicating a trivial problem.option 2 forces me to use a program like Maya,
Transformation matrices, and a consistant approach to working.I'm just trying to get a sense of what is more commonplace in the game industry.
#6 Members - Reputation: 1059
Posted 28 July 2012 - 02:10 PM
#7 Members - Reputation: 1408
Posted 29 July 2012 - 01:55 PM
Exactly, I agree.No it doesn't. It means you need to use some trivial matrix maths. Using Maya/Max et al, is just over-complicating a trivial problem.option 2 forces me to use a program like Maya,
OpenGL does not specify a default up axis. It depends soley on your camera transform.
Just some nit picking, but you can program OpenGL without any matrices or transforms at all, if you want. OpenGL no longer has a "camera transform" concept, and 'y' is up on the screen as default.
glRotated(90.0,1.0,0.0,0.0); or glRotated(-90.0,1.0,0.0,0.0)
This is deprecated OpenGL functionality, please don't recommend it. And if you would use it anyway, it is not recommended as it use double precision. That may cost a lot of performance.
Edited by larspensjo, 29 July 2012 - 02:03 PM.






