See the “Depth Buffer” section of the Modern Graphics Programming Primer for more: https://keasigmadelta.com/graphics-primer