Relative Depth-Buffer Imprecision

z: za+zb/z
w: (z-zn)/(zf-zn)
log: log(z/zn)/log(zf/zn)
log: log(C*z + 1)/log(C*zf + 1) C
z as k-bit float e.(k-e)
w as k-bit float e.(k-e)
reverse z as k-bit float e.(k-e)
reverse z, fixed point
zn
zf
k (depth buffer bits)
e (floating-point exponent bits)
mf (min denormal mantissa to use, 0..1)
reset

x-axis is view-space z (log scale), y-axis is relative imprecision.

"Relative imprecision" at a particular z value means how far apart (in view space) the neighboring discrete depth values are, divided by view space z.

Note on floats: I'm simulating a perfectly optimized float format for depth buffers -- no sign bit, and mapping the full value range exactly onto [0,2^k-1]. I think real-world IEEE floats will be about 2 bits worse.

(Editorial) The smaller the relative imprecision, the better. Anything above around 1e-3 is ripe for z-fighting. Anything below 1e-6 is very good.

See also log_depth_buffer.txt