Z-Fighting

From polycount
Revision as of 20:53, 13 July 2011 by EricChadwick (Talk)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Z-Fighting

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.

In this day and age it's less prevalent due to multistage texturing in shaders but occasionally still rears its ugly head depending on geometry, software or hardware.

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, and use that. 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