Pierrick Picaut show in his video how to perfect use z-pass in Cycles Rendering. We recommend the video and whole channel.