View Full Version : Polygon Overlapping problem.
11-22-2007, 06:28 PM
I try to render 2 polygon A and B. Say polygon A is a clone of polygon B and offseted 1 unit to the positive z. When I rotate the view to a certain angle, certain area of polygon A is overlapping with polygon B. How to get rid of this problem? Thanks.
11-22-2007, 06:45 PM
Do you see z-fighting (http://upload.wikimedia.org/wikipedia/en/5/58/Z-fighting.png) ?
You need to get more depth precision.
Put the near plane farther, and the far plane nearer.
11-22-2007, 07:46 PM
Thanks, it is exactly as what you have mention. Is it the only solution for this problem is to decrease the distance between near and far plane?
11-23-2007, 03:58 AM
- make sure you have a 24 bits depth zbuffer (16 bits is ugly)
- increase your offset (1 unit is very small).
- what I said above.
11-23-2007, 06:15 AM
One more idea is to sort your polygons.
Sorting however, shoud not be based on distance function. Proper sorting means you check if one polygon is in front or behind other by testing one polygon's vertices against other polygon's plane.
Then you use GL_LEQUAL function and draw from furthest to nearest, or GL_LESS function and draw from nearest to furtest (second option is recommended, because it will take advantage of early-z optimizations on the GPU).
Of course, you use this solution only if these pointed out by ZbuffeR don't meet your needs for some reason.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.