This tutorial for the Houdini user shows you the correct method for creating a zdepth pass in your project, as well as a few techniques you can use to create a fake depth of field effect and use the compositor to add fog.