|
From: James W. <ja...@fr...> - 2008-10-10 02:30:41
|
Some 3D formats allow applying different materials to the front and back faces of materials, and I was thinking about how to do that with Quesa. Preferably, I'd want to do it without duplicating the geometry, to save memory. At first I thought that backface culling plus orientation styles would do the trick: Counterclockwise orientation + backfacing-remove means that we define the counterclockwise faces to the the front, and cull out the clockwise ones. Clockwise orientation + backfacing-remove means that we define the clockwise faces to the the front, and cull out the counterclockwise ones. However, we need to take the vertex normals into account. If the normals were created to face toward the counterclockwise face, then when rendering the clockwise face, we need to flip the normals. Currently, Quesa will only flip normals (OpenGL two-sided lighting) when it's not doing backface culling. What I'm considering is adding a new backfacing style, call it kQ3BackfacingStyleRemoveFront, which will cull out the front faces (where "front" respects the orientation style), but also use two-sided lighting. With this addition, one could render two faces with a structure like this: Group front attribute set backfacing style remove geometry Group back attribute set backfacing style remove-front another reference to the same geometry Does that make sense? -- James W. Walker, Innoventive Software LLC <http://www.frameforge3d.com/> |