I have been doing some 3d-graphics with OpenGL and Direct3D lately and have been wondering about the seemingly strange implementations of the z-buffer in both. Both documentations say that the value used in z-buffer is not actually the z-coordinate relative to the camera, but something like (z+near_plane_dist)/w. This means we lose log2(far_plane_dist/near_plane_dist) bits of z-buffer precison. Have I understood it right? If yes, then souldn’t this be corrected so that we simply use the z-coordinate relative to the camera position?
After thinking this a bit, it seems that what I was thinking is called w-buffering. DirectX can use it if the hardware supports it.