Original Post
Hi, I have implemented shadow mapping using GLSL vertex/pixel shaders in my 3D app. From the light's point of view, only back-facing polygons are rendered to the depth maps. When rendering the scene from camera's PoV, the scene is rendered once for each light source per frame and their contributions are accumulated in the framebuffer using additive blending. I decided to use 6 user clip planes to cull away geometry that's not within the spotlight's frustum and this gives significant performance boost. The problem is that user clip planes generate new vertices which causes z-fighting between pixels from different rendering passes. The image below illustrates this problem: http://img180.imageshack.us/my.php?image=snapshot029mt.jpg The smaller spotlight gets rendered first, and the larger spotlight rendered at next pass is z-fighting with it. Only solution that comes to mind is to increment glPolygonOffset a bit for each pass, eg: glEnable(GL_POLYGON_OFFSET_FILL); for(int i = 0; i < numlights; i++) { glPolygonOffset(1, i); // Render the scene here... } But this seems little awkward to me, not to mention some other problems it might pose. My question is, is there any better solution?