Thread: Z-Fighting

  1. #1
    Registered User Josh Kasten's Avatar
    Join Date
    Jul 2002
    Posts
    109

    Z-Fighting

    Anyone know how to minimize z-fighting?
    int a; don't make a program without it.

  2. #2
    vae victus! skorman00's Avatar
    Join Date
    Nov 2003
    Posts
    594
    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.

  3. #3
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    New York
    Posts
    1,905
    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.

  4. #4
    Registered User Josh Kasten's Avatar
    Join Date
    Jul 2002
    Posts
    109
    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.

  5. #5
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    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.

  6. #6
    Registered User
    Join Date
    Mar 2003
    Posts
    580
    Quote Originally Posted by Josh Kasten
    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.
    That's what I've done...changed the number of bits allowed for the z buffer, and that definitely has helped.

    I don't understand exactly what Bubba meant, but you should look into that too because it probably works.
    See you in 13

  7. #7
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. MURK - a small preview
    By Mario F. in forum Game Programming
    Replies: 27
    Last Post: 12-18-2006, 08:22 AM
  2. Fighting game help
    By aaron11193 in forum C Programming
    Replies: 5
    Last Post: 10-31-2006, 03:58 PM
  3. Fighting AI Algorithm
    By hdragon in forum Game Programming
    Replies: 5
    Last Post: 06-15-2006, 03:19 AM
  4. Philosopher Fighting Game
    By LuckY in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 12-07-2004, 02:43 PM
  5. My fighting game
    By fuh in forum Game Programming
    Replies: 7
    Last Post: 12-22-2002, 09:37 AM