Lecture 6: Graphics Pipeline (14)
RCD-Y

In lecture the case with two same depths was brought up. I believe this becomes "z-fighting" where floating point inaccuracies decides which triangle is drawn, which in practice is shown as flickering.

bobcao3

You can spot Z-Fighting in games where objects are very close or in identical places

han20192019

I think this Z-buffer algorithm is very efficient and clever. It avoids the problem of sorting all the arrays which same time. Instead, it just iterate through all the objects and keep the pixel with the smallest Z value.

alexkassil

One idea to stop/make z fighting less noticible is by including a small epsilon range so that if two objects/triangles are at a very similar distance away from viewer, there isn't a flickering as the camera moves slightly.

dominicmelville

As z-fighting is often the result of the lack of precision in floating-point calculations, one possible solution is to store the log of the z value rather than the z value itself. This essentially gives you a greater z resolution for objects near to the camera. As most games are set up to render more detail in areas closer to the camera, this setup reduces z-fighting in the places where it would be the most likely to occur. You can read more about it here: https://outerra.blogspot.com/2009/08/logarithmic-z-buffer.html

You must be enrolled in the course to comment