z-fighting
This is freaking me out. Imagine a random number of faces on the xz plane, all with the same height, and a huge mesh that is rendered over them, normally causing z-fighting. Instead of overlapping, I''d like the large mesh only to appear where the heights do not match - that is, avoid z-fighting by not rendering the large mesh where it overlaps with anything else. In order to do this, you''d set the depth buffer to 32 bits to be sure, render all the smaller faces that you want to be left visible first with GL_LEQUAL or GL_LESS or whatnot is appropriate in that particular case and then render the huge mesh on top of it all with, with GL_LESS, right? Can anyone tell me, then why is it still causing z-fighting?
"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared
Z fighting is caused by a roundoff error when you draw two polygons(or lines) that are exactly on the same plane but does not have the same size or position.
It causes the second plane to be drawed randomly either on the far side, the nearside or directly at the first plane.
This means that if your using GL_LEQUAL, GL_LESS or whatever(exept GL_ALWAYS and GL_NEVER, but then your getting other problems), it really dosn't matter.
And Z-fighting can't be fixed by a more detailed depthbuffer.
Infact it can make it worse.
The only solution is to not draw them on the exact same plane.
my suggestion it to draw the mesh with an ever so slight offset in the y plane.
[edited by - lc_overlord on November 1, 2003 9:08:51 AM]
It causes the second plane to be drawed randomly either on the far side, the nearside or directly at the first plane.
This means that if your using GL_LEQUAL, GL_LESS or whatever(exept GL_ALWAYS and GL_NEVER, but then your getting other problems), it really dosn't matter.
And Z-fighting can't be fixed by a more detailed depthbuffer.
Infact it can make it worse.
The only solution is to not draw them on the exact same plane.
my suggestion it to draw the mesh with an ever so slight offset in the y plane.
[edited by - lc_overlord on November 1, 2003 9:08:51 AM]
www.flashbang.se | www.thegeekstate.com | nehe.gamedev.net | glAux fix for lesson 6 | [twitter]thegeekstate[/twitter]
That''s what I ended up doing. I just figured that setting the depth buffer to 24 bits would give me enough precision, especially on a non-computational flat plane and that I could supercede the large mesh whereever the polygons overlapped. Anyway, it turned out better with substantial offsetting. Cheers for the reply, anyway.
"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement