Surface-Based Depth Map in Shader Mixer
Since the current depth-related stuff in Shader Mixer is camera-only, here's a snippet of code as a custom brick which allows a surface-based depth shader. Maps the scene from white (close) to black (far) based on min and max variables.
ShareCG link including custom bricks for the depth map functionality itself and the basic raw 'distance between viewer and surface', plus images and a Shader Mixer file so the internal nodes can be poked through more easily for those who have the inclination to do so (ungrouping the brick unfortunately messes up the arrangement).
The bricks in the network have been retitled to make their function more understandable. The following post explains what's going on.
(Yes, I know the preview image is godawful ugly.)