1
$\begingroup$

In my current Project, I use a Render Layer node and it's z output to obtain a depth image of the scene. My question now is, the distance obtained from this output, does give me the distance from the nearest object point to the camera plane. This is quite clear when using orthogonal projections where all rays run in parallel but what is this z-value when using perspective projection like in real cameras? Does blender already calculate the distance to the camera plane like shown in this image?

z-values?

Or is it the distance along the ray?

Another question concerning this topic: Does anybody know an alternative way to obtain depth data in blender, different than using the render layer? (Unfortunately, This method does not work in background mode)

$\endgroup$
  • $\begingroup$ please ask just one question at at time. Feel free to open another thread to get multiple questions answered. $\endgroup$ – adegner Jan 9 '17 at 15:13
1
$\begingroup$

When you use a perspective camera, the Z value is the distance to the camera, or the ray distance.

Z pass of plane with perspective camera

$\endgroup$
  • $\begingroup$ Maybe this question is out of topic, but you may also know which of those two values is obtained by using the Kinect? $\endgroup$ – mrks Jan 10 '17 at 9:55
  • $\begingroup$ @user269524 Unfortunately I'm not familiar with the Kinect or its API, but the documentation seems to indicate that the depth sensor returns the distance to the camera plane. $\endgroup$ – binweg Jan 10 '17 at 11:32
2
$\begingroup$

Quote from blenderguru

View Z Depth and View Distance are very similar and most of the time it doesn’t really matter which you use. But to be thorough: the Z Depth is essentially a plane in line with the camera, and the Distance is literally the distance from the center of the camera emanating radially outwards.

Z Depth vs View Distance

This is for input, not for output but I assume that since the terminology is the same it should do the same calculation.

This brings me to the second question. You could use the above mentioned input on a separate render layer with a material override,

ZDepth material override

$\endgroup$
1
$\begingroup$

It is the distance to the camera plane as shown in the picture. You can check that by rendering a plane orthogonal to the camera plane and compare the z-values of different spots on the plane.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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