Difference between revisions of "Z-Fighting"

From polycount
Jump to: navigation, search
m (2 revisions)
(image and formatting fixes)
 
Line 1: Line 1:
__NOTOC__
+
[[image:Z-fighting.png|thumb|Z-fighting between two coplanar models. <BR> Image by [http://en.wikipedia.org/wiki/User:Mhoskins mhoskins] ]]
= Z-Fighting =
+
 
Also called flickering, duplicate geometry, coplanar meshes, shimmering.
 
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.  
 
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.  
 
{| border="1" cellpadding="2" cellspacing="0"
 
|-
 
|}
 
  
 
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.
 
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 ==
+
= Solutions =
 
Figure out what the minimum distance is for your game:
 
Figure out what the minimum distance is for your game:
 
# Make a plane primitive and snap it to a large ground model.  
 
# Make a plane primitive and snap it to a large ground model.  

Latest revision as of 04:15, 26 November 2014

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