Z-Fighting

From polycount
Revision as of 04:15, 26 November 2014 by Cman2k (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Z-fighting between two coplanar models.
Image by mhoskins

Also called flickering, duplicate geometry, coplanar meshes, shimmering.

Z-fighting is a term used in 3D games to describe two (or more) polygons which are coplanar, or very close. Tiny rounding errors usually mean that the geometry appears to flicker as pixels from one piece or the other appears seemingly randomly.

A good example would be a billboard on a brick wall - the player can never see behind the billboard but the artist might still be tempted to leave the brick wall there for speed and simply position the billboard quad over the brick wall with a tiny amount offset. Depending on z-buffer setup and the hardware it's running on you might see a strange billboard/brick interference pattern as you move about the scene.

Solutions

Figure out what the minimum distance is for your game:

  1. Make a plane primitive and snap it to a large ground model.
  2. Move the pivot slightly below the plane, and re-snap.
  3. Export to the game and spin the camera.
  4. Rinse and repeat until you find the minimum safe distance that you can "float" a plane above another surface without flickering/z-fighting. You can then clone this mesh to create all future "floaters" (posters, litter, decals, etc.)

Some game tools will allow you to manually offset the Z-test values that a model will use. So the model can be coplanar with another model, but it is forced to use slightly different depth values when it is rendered.


Personal tools
Namespaces

Variants
Actions
Navigation
Tools