Set and display correct Z depth values Blender render
This is the default formatting of Blender's z-buffer, so I'm not sure where you're stuck? Are you trying to get these values into the RGB channels? If so, you can simply copy them like this:



Remember to save this in a linear floating point format (such as OpenEXR). Formats such as PNG will mangle this data, as they are not meant to store depth.

I should probably add, using the Combine RGBA node here isn't strictly necessary, it still works if you connect Z directly the Image output. Using the Combine RGBA just lets you specify each channel explicitly to be on the safe side.