Z-fighting

Last Updated: November 12, 20241.5 min read

Overview

Z-fighting is a term used to describe the visual artifact that occurs when two polygons have very similar depth values. This can cause the polygons to appear to flicker or “fight” for the same space on the screen.

Z-fighting is caused by the way that depth values are stored in computer graphics. When a polygon is rendered, its depth value is stored in a special buffer called the z-buffer. The z-buffer is used to determine which polygon is in front of which.

When two polygons have very similar depth values, the z-buffer may not be able to accurately determine which polygon is in front. This can cause the polygons to flicker or “fight” for the same space on the screen.

Z-fighting can be caused by a number of factors, including:

  • Using a low-resolution z-buffer
  • Using a low-quality depth buffer
  • Having two polygons with very similar depth values

There are a number of ways to reduce or eliminate z-fighting, including:

  • Increasing the resolution of the z-buffer
  • Using a high-quality depth buffer
  • Splitting polygons that have very similar depth values

Here are some additional details about z-fighting:

  • Z-fighting is a common problem in computer graphics, and it can be difficult to completely eliminate.
  • There are a number of techniques that can be used to reduce or eliminate z-fighting, but the best technique will vary depending on the specific application.
  • Z-fighting can be a significant visual artifact, and it can be distracting or even disorienting to the user.

If you are experiencing z-fighting in your computer graphics application, there are a number of things you can do to try to reduce or eliminate it. By understanding the causes of z-fighting and the techniques that can be used to reduce it, you can create more visually appealing and immersive graphics.

Feedback

Please be sure to submit issues or feature requests through the embedded feedback form. In the event it is a major issue please contact us directly through Discord.

Table of Contents