what is z fighting

11 months ago 19
Nature

Z-fighting is a phenomenon that occurs in 3D rendering when two or more primitives have very similar distances to the camera, causing them to have near-similar or identical values in the z-buffer. This can result in flickering or visual artifacts as one primitive is displayed behind or in front of the other. Z-fighting can be caused by different factors, such as insufficient precision in the depth buffer or different transformation paths in hardware for the same geometry.

There are several ways to reduce or eliminate z-fighting, including using a higher resolution depth buffer, z-buffering, moving the polygons apart, or applying a post-transformation screen space z-buffer offset to one polygon. If z-fighting is caused by different transformation paths in hardware, it can sometimes be resolved by requesting that the hardware use invariant vertex transformation. Another technique used to reduce or completely eliminate z-fighting is to switch to a logarithmic Z-buffer that reverses Z. This technique can be seen in the game "Grand Theft Auto V".