For a side-project that I’m currently working on, I have some simple quad-based objects that I want to be able to flip across their vertical axes. To that end, I’m setting their x-axis scales to -1 when I want them flipped. (Simply rotating them won’t work, I believe, as they’re not symmetrical.)
In and of itself, this works: the objects are flipped as intended.
However, this does mess up the lighting of the objects in question.
Now, as I understand it there are two components to this: (1) The objects’ now have a back-to-front winding order, leaving me seeing back-faces instead of front-faces, and (2) The objects’ normals are now the wrong way around.
Thus far the only element to a solution that I’ve found is to find the relevant GeomNodes, dig down to their primitives, and call “reverse” on those.
The following is my current approach to doing so:
geomNP = self.currentPoseCard.find("**/+GeomNode") if geomNP is not None and not geomNP.isEmpty(): for geom in geomNP.node().modifyGeoms(): for prim in geom.getPrimitives(): prim.reverse()
From what I see in the API entry for the “reverse” method, I think that I might further have to re-add the primitive to the Geom after the call. However, that aside, the API entry also indicates that it this method alone is not necessarily enough to fix lighting issues.
So, how might I fix this? Is there a way to flip the normals? Am I mistaken in what’s called for here? Is there perhaps a less-awkward solution? Or is there a less-troublesome method of flipping my objects?
(Oddly, in another program that same objects seem to be lit as desired–perhaps because the lights are applied after the objects are flipped?)