Confusing export transformations

Digitalghost

03-04-2006 01:30:24

Alright, I have a simple mesh in MAX which is just a quad which has vertices at 0,0,0 36,0,0 36,36,0 and 0,36,0. The normal of both triangles is 0,0,1.

I exported the mesh and then ran the xml converter to convert it back to XML. Notice how all of the z values are negative (I'm assuming that the y and z axes were swapped in the export process):

...
<vertex>
<position x="0" y="-4.57764e-005" z="-0" />
<normal x="0" y="1" z="-0" />
</vertex>
<vertex>
<position x="36" y="-4.57764e-005" z="-0" />
<normal x="0" y="1" z="-0" />
</vertex>
<vertex>
<position x="36" y="-4.57764e-005" z="-36" />
<normal x="0" y="1" z="-0" />
</vertex>
<vertex>
<position x="0" y="-4.57764e-005" z="-36" />
<normal x="0" y="1" z="-0" />
</vertex>
...

The result is that all of the objects in the scene are backwards. I checked the box "flip z axis" and it reversed the sign on all the z coordinates. The problem is that now the order of the vertices in the faces is wrong. Flipping the normals doesn't help because that just changes the direction of the normals, it doesn't reorder the vertices in the faces so that the faces face in the opposite direction.

All of my objects have non-negative vertex coordinates and I'd like to keep it that way in Ogre without having to hack it.

Thanks for any help! =)

Digitalghost

03-04-2006 04:09:22

I found a workaround that should work fine, but is kinda a pain in the ass.

I took all of my meshes and applied a mirror over the y-axis (the XZ plane), then I applied another Xform to reset the Xform. This produced the meshes I was expecting when I exported.

There obviously must be another way of doing this because other people have used ofusion with success. Is my coordinate system in the game incorrect? Basically I'm using terrain so I have tiles which start at 0,0 and extend outward in the X and Z dimensions. This is why having negative values for vertices doesn't make sense.

Lioric

03-04-2006 19:19:53

Unless you are using a custom scene manager that uses a different axis system, i dont see how you are having issues with the coordinates

Max uses a different axis system than Ogre (i.e. +Y in Max is -Z in Ogre), so it sure makes sense

How is the display in the oFusion viewport?

Can you post a screenshot of your issue?

If you are using the exported files with another axis system, you should post what axis system is that

Digitalghost

03-04-2006 19:26:11

What makes you say that +y in max is -z in ogre? I was assuming hat +y in max would be +z in ogre

Lioric

03-04-2006 20:16:01

You are wrong

jacmoe

03-04-2006 20:56:38

Is Max left-handed, then? :)

Digitalghost

03-04-2006 21:50:24

You are wrong

Is Max left-handed, then? Smile

MAX is a left-handed co-ordinate system. If the default scene manager OGRE is a right-handed co-ordinate system, then I'm wrong, but I don't think that OGRE is neither right nor left-handed. I believe it's application-dependent. My application happens to use a left-handed coordinate system, so in my case +y in max is +z in ogre. You (probably) used a right-handed coordinate system when you wrote the oFusion viewport and that's why it works.

I figure I'm early enough in the application that I might as well deal with negative values for all my z coordinates and move on.

If there's a connection with the scene manager and the axis system, please let me know.

Digitalghost

03-04-2006 22:11:54

Actually now that I think about it, there has to be that information encoded into Ogre somehow because there's a correltation between the direction the camera moves and it's location in 3d-space, so I'm probably wrong. I'm probably compensating for that by reversing the sign in the translate vector.

Sorry about that! This 3d stuff really confuses me sometimes.

Love the plugin BTW.

Lioric

03-04-2006 23:02:12

Jacmoe, yes max is left-handed (in the modeling application sense, not in the D3D sense)

Digitalghost, Ogre uses a right-handed axis system, is not application dependant, see this thread:

http://www.ogre3d.org/phpBB2/viewtopic.php?t=18856

Digitalghost

03-04-2006 23:08:15

Jacmoe, yes max is left-handed (in the modeling application sense, not in the D3D sense)

Digitalghost, Ogre uses a right-handed axis system, is not application dependant, see this thread:

http://www.ogre3d.org/phpBB2/viewtopic.php?t=18856


Got it, thanks again. Sorry to bother you.