3
$\begingroup$

This question already has an answer here:

Using Cycles as a render engine, I assigned an empty as a camera Track To target, and as the focus target in Depth of Field, yet rendering the scene, the depth pass is rendering all white, as if there's no depth of field, while the combined pass is rendering just fine, am I doing something wrong?

enter image description here

$\endgroup$

marked as duplicate by p2or, Community Mar 31 '16 at 20:25

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ @poor I thought that there's something wrong I'm doing, being a new user of Blender, I thought that simply checking the Z pass, should give the required result, I just wanted a simple way to do it without going to compositor and connect all the nodes "because I'm not an experienced user", but looks like the only way is doing it in the compositor! $\endgroup$ – Georges Mar 31 '16 at 19:22
  • 1
    $\begingroup$ Unfortunately not :/ For Z only you can duplicate the scene, enable the 'Z pass' and re-render the scene via Material Override. For a fast solution you could also try the 'mist pass': blender.stackexchange.com/a/6722/3710 $\endgroup$ – p2or Mar 31 '16 at 19:50
  • 2
    $\begingroup$ There is a bit of confusion here. The Z pass will not give you depth of field information. The Z pass will give you the distance from the camera to objects for every pixel. That distance is expressed in blender units (or whatever other units you are using for your scene. The Z pass cannot be properly represented in the viewer. The viewer maps 0 to black 1 to white. Any value larger than 1 will be clipped and represented as white. $\endgroup$ – cegaton Mar 31 '16 at 20:59
  • 1
    $\begingroup$ Likewise, most image formats can't store the information unless is normalized or tone-mapped. To properly store the Z pass you need an image format like OpenEXR that can deal with values larger than 1 and preserve the information as linear. $\endgroup$ – cegaton Mar 31 '16 at 20:59
11
$\begingroup$

No, you're not doing anything wrong.
The Z-Pass is one of just a few, when not even the only pass that doesn't have a range from 0 to 1. It goes from almost Zero to infinity. Every pixels gets assigned a value that shows how far away it is compared to the camera. If a pixel is 75 Blender Units away it gets assigned the value of 75.
If you output the Z-Pass through the viewer it will only show values between 0 and 1. Everything above 1, which is probably everything in your scene, will be shown as white.

If you are using nodes like Z-Combine it will work perfectly fine.
For other compositing purposes you'll want to use the Map-Range node:

enter image description here

Input the Z-Pass into the "Value". Than change the "From max" value to the object furthest away from your camera. You'll see the effect by cranking up the value.
For visualisation purposes only I recommend the Normalize-Node:

enter image description here

This node will take all values and shrink them down to a range between 0 and 1.
For Still images this probably is the easiest way, for animations use the method shown above.

$\endgroup$
  • $\begingroup$ When you say nodes, do you mean in the compositor? I guess I should watch more tutorials about this subject, I still need to understand where to connect all these nodes, I'm still kind of new to Blender. Thank you for your answer. $\endgroup$ – Georges Mar 31 '16 at 19:14
  • $\begingroup$ The only thing I can't understand so far, is how can Cycles show the DOF effect very accurately in the Combined pass, and still needs so many operations to get the Z depth image. $\endgroup$ – Georges Mar 31 '16 at 19:26

Not the answer you're looking for? Browse other questions tagged or ask your own question.