Anyone know how to minimize z-fighting?
Anyone know how to minimize z-fighting?
int a; don't make a program without it.
Sometimes adjusting the near clip plane will fix some problems. The closer it is to 0, the more likely it is to happen. here's an explanation as to why that is:
http://www.sjbaker.org/steve/omniv/l..._z_buffer.html
Other than that, don't draw geometry so close to eachother. If you really need to, you can try some depth testing yourself instead of letting the buffer do all the work.
Last edited by skorman00; 11-04-2004 at 11:55 PM.
Hey foo, we already went through this! You forgot everything I told you already? In GL I've been keeping my near clip plane to about 1 or 2, depending how bad the z-fighting gets. Anything <1 tends to start showing artifacts in the distance and lots of z-fighting stuff.
I knew that changing the clipping plane help(should of said that) but this link really tell ya whats going on.
http://www.sjbaker.org/steve/omniv/l..._z_buffer.html
Changing Z buffer to 24 helped a lot more then changing the clipping plane ever did. And it sounds like 24 bit z buffing works on any half way good cards. Try this on some of your programs jeff. Thanks for the help guys.
Last edited by Josh Kasten; 11-05-2004 at 02:50 AM.
int a; don't make a program without it.
In Direct3D I simply use a z-bias method that offsets the desired polies/textures a certain distance based on the bias value. You can look on www.msdn.com for more information relating to z-fighting as it pertains to D3D. I'm sure the principles can be applied to OGL.
That's what I've done...changed the number of bits allowed for the z buffer, and that definitely has helped.Originally Posted by Josh Kasten
I don't understand exactly what Bubba meant, but you should look into that too because it probably works.
See you in 13
A z-bias is simply a zvalue by which to offset one poly. For instance in IL2FB when you take off and fly high the runways flicker on the terrain because they z fight with the terrain. The solution is to overlay the runway on the terrain by using a bias value that determines the offset of the runway in relation to the terrain height. Too high of an offset will cause the runway to appear as if it is floating above the terrain which is not good. Too low will not solve the z fight problem.
This also appears quite frequently in 3D cockpits for sims. The polies of the dashboard z fight with the texture overlays of the instruments. The solution is to offset the instrument textures some distance away from the surface of the dashboard polies. This usually produces very good results and the shimmering and flickering normally disappears.