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! =)
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! =)