[Maya2osg-users] Triangle winding question (maya usage)
Status: Alpha
Brought to you by:
jtaibo
From: Jean-Sébastien G. <jea...@cm...> - 2011-10-14 17:13:35
|
Hi guys, This is a Maya usage question... Hope you don't mind. Our modelers often create symmetric pieces by first creating half, then duplicating that half, scaling it by -1, reversing the normals and then freezing the transforms. This seems to work fine, at least in Maya, except that I notice now that triangle winding (vertex order) is still inversed when they do that. This manifests itself in two ways in our realtime app: Lighting considers the wrong side of a face (light seems to come from the opposite side) and backface culling is reversed (faces are culled when looking from the outside instead of from the inside). I wonder, is there a way in Maya to reverse the triangle winding? I can write a script (or search the net for one), but is there something built-in? I was thinking of writing a script that would go through all polygons of a model and compare the "implicit normal" (calculate a normal using the vertex order in the triangle) to the saved normal (in the normal array) and if it doesn't point in roughly the same direction, reverse the vertex order. This assumes that the artist has made his normals all point in the correct direction, so the normals are used as reference to correct the triangle winding. I could then put this script on preExport in the plugin. My question is really, do I have to do this myself or is there something already there I can use? Thanks in advance, J-S -- ______________________________________________________ Jean-Sébastien Guay jea...@cm... http://www.cm-labs.com/ http://whitestar02.dyndns-web.com/ |