z-buffer fighting

is there anything else, beside keeping your znear/zfar ratio sensible, that can eliminate nasty z-buffer fighting? just wanted to see from the more experienced if there are techniques I am not aware of…
thanks appreciated.

For static scene, you can sort the polygons for each normal direction (+X,-X,+Y,-Y,+Z,-Z) :
Draw the carpet before the floor,
Draw a poster before the wall…
and use GL_LESS for Z-buffer comparison.

The problem remains for polygons that have different orientation but it’s better than before!!!

if it’s about polygons that have the same orientation and are virtually on the same plane (like posters on the wall or burnt spots from using the flamethrower in a game ) polygon offset would be the way to go… just set the polygon offset to a value != 0 (+ or - depends on your depth buffer function) and then draw the poster/burnt spot. the offset will be added (i think, not sure) to the zbuffer values before the depth test, so that even polys that are in exactly the same plane can be rendered over each other.

The obvious solution is to increase the depth buffer bits. 16bit->32bit.

also its possible to use 2 or more differnet depth ranges in your program so draw all all near stuff with one range and change it for the far stuff

Thanks for replies. However, I’m not sure if and how I could use some of these techniques in my particular application. I’m basically rendering a bsp map with frustum and back face culling, so the number of faces to draw changes dynamically. Dunno how I could efficiently add z buffer sorting on top of this. Currently, I set my znear and zfar to 1.0 and 4000.0 respectively, so the ratio seems ok, but I’m experiencing nasty z buffer problems, like banding, texture distortions…

I use GL_LESS. I request 32-bit depth buffer.
thanks