This example is interesting because there is a tie in the cells that have a 5.
If you've played video games, you probably have seen glitches where two overlapping objects will flicker because their z values are the same and the rendering engine can't decide which one to prioritize.
This phenomenon is called Z-fighting. You can read more on Wikipedia (has a good image example). https://en.wikipedia.org/wiki/Z-fighting
Given the convention for z-axis, would all these values actually be negative?
@irisli. Nice link! I read through the link provided and found a pretty interesting solution to Z-fighting done by the makers of GTA. They instead used a logarithmic scale, and due to the encoding of smaller number, gained greater precision with numbers closer to 0. This gave the depth more detail and meant there was less z-fighting!
@irisli @tristanburke another interesting way to prevent z-fighting mentioned in the link is to artificially truncate the visible depth by simulating objects past a safe renderable depth. These far away objects' z-buffer values can be truncated at the maximum and then scaled by the true distance. This allows representation of a large range of z-values without needing a infinitely high resolution z-buffer