In Blender Cycles a Z pass can be automatically normalized with a Normalize node. A Mist pass is anti-aliased and have smooth shading.
How to get automatically normalized and anti-aliased depth map?
I tried the method with Ray Length input, normalizing works fine but I got an unsatisfied result with compositing — the thin gray background that I have to add to normalize the image:
The Mist pass can't be automatically normalized properly, because all the space behind the object is equal 1.
Or should I do it in the other proper way?