6
$\begingroup$

I've been using Blender to generate depth maps using z pass. I notice that the z pass generated by different render engines are different, which made me a bit confused. My feeling is that the z pass generated by Cycle render denotes distance from a given pixel to the camera center while Blender render generates an orthogonal distance to the camera plane. Do I understand it correctly? Is so, is there a way to change such behavior for both render modes?

As an example, the bottom area of the model is a flat surface, to which the camera is perpendicularly pointed. Below are the nodes I use to normalize and visualize the z pass data (Viewer node is used to save the depth map).

Nodes to normalize and view

Z pass with Cycles render:

Z pass with Cycles render

Z pass with blender render (everywhere same value in the bottom part):

Z pass with blender render

$\endgroup$
2

1 Answer 1

3
$\begingroup$

When rendering a Z pass you are essentially creating a depth map from the camera point of view. The issue here is there is potentially infinite range of distances to represent by colors and only 256 shades of gray available to map them to, in a traditional 8 bit image you have .

It can go from zero close to the camera (unlikely there is something this close) to whichever visible object is most most distant. But there may also be a sky or "background" at a theoretical infinite distance.

There are several possible ways to map these shades of grey to the distance progression each with its own advantages.

It can be a linear mapping where detail is distributed evenly across all image, but here may also be logarithmic mappings, emphasizing detail at certain parts of the picture.

  • You may want more detail at close range where image focus is likely to reside.
  • The scene may require more detail at large distances if you are rendering a landscape or distant view
  • You may want to use it for a mist pass requiring details at a medium range.

As far as I know would expect both Cycles and Blender Render to use the same "true distance to sensor", not a virtual orthographic plane passing through the sensor, but I may be wrong.

If that is indeed the case or you require a specific color progression or custom mapping of values you may construct your own "an artificial Z pass".

You can do so by making a basic emission shader with a circular black to white gradient mapped to the camera object.

Moving the camera should update the position. You can scale the gradient as desired to accommodate your desired distance range, and drive it through a Color Ramp for a non linear progression.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .