PDA

View Full Version : Problem with drawing Twisted Cubes



Tom Thorp
04-12-2008, 08:52 AM
In my application, I need to render my output as a collection rectangular objects with a very small depth. I"m creating my objects by getting coordinates for the front face with normal vectors. I create the back face and sides by moving back a "thickness" amount along the normal vector. I do this as part of an initial build phase. Then during the paint handler, I apply a material color for front and back lighting.

My problem is that some cubes are "twisted", meaning that the front left and right edges have opposite slopes. Because of this, for part of the front face of the "cube", the back surface is actually drawn above the front surface. Obviously, making things look bad with triangular shaped cutouts.

Without tessellating the surface into two triangles (which works well), is there another way to do this?

Tom