How is Z Depth used in Style?

What is Z Depth?

Z Depth map is a picture that records the distance of an object to the camera using the greyscale colour values of the pixels. For example, we can define that points closer to the camera are blacker and points further away from the camera are whiter. We can then get the following Z Depth image:

Where to turn on the Z depth map in D5?

There are two places in D5 Render related to the Z depth map:

  1. In the effect panel, there is a Z depth option under the Style module:

  1. The Z depth channel can be customized when outputting images/videos:

What is the difference between the Z Depth in Style and the Z Depth Channel of the output?

Z Depth Style

The Z-Depth screen in Styling is the same as the preview in the D5 viewport, it's just a styling effect that can be toned by post-processing and can be mixed with the Line Drawing mode. We can adjust its exposure, contrast, and even its colour temperature, tint, and other parameters.

As shown below, this is an image that combines Z depth and Outline mode Style, where the main post-processing effects are: dark corners, colour temperature, tint, dispersion and so on.

Z Depth Channel (Z Channel)

In contrast, when outputting images/videos, the custom-selected Z Depth channel is the standard Z Depth map, which is a picture representing the distance from the object to the camera, and is a greyscale map that is not affected by post-tinting parameters.

The pixel colour value of a standard Z Depth Map is proportional to the distance from the object to the camera.

For example, if we specify that a point 0m from the camera is black (with a colour value of 0), and a point about 100m from the camera to infinity is white (with a colour value of 255), then a point about 50m from the camera will appear as grey with a colour value of 128.


  1. Whether you turn on the Z Depth switch in Post Style or not, you can output the Z Depth channel when outputting the image/video*. (*Video framing Sequence is a Pro feature)

  2. The distance from the black/white range of the Z Depth channel to the camera depends on the value defined by the Post Style Z Depth slider. This means that even if you only need a Z Depth channel map, you can use the Stylised Z Depth function as a preview of the black and white distances, and once you are satisfied with the distances, you can turn off the Z Depth Style switch, at which point the modified distance values will still be valid.

How to use Z Depth slider in Style?

When outputting a Z Depth map, because of the variable dimensions of a 3D scene, the most important parameter is to define the distances of the "black point" and the "white point" to the camera. If the distance between the black and white points is defined properly, the Z Depth map can contain more distance information, which is of rich layers and helpful for post-processing.

Note: To avoid ambiguity, black and white in the following descriptions refer to the colour of the standard Z Depth channel map at the time of image/video output, as they will not be affected by the colour grading parameters.

Default Value

For a new scene, D5 defines by default that objects 0 metres from the camera are pure black (colour value 0) and objects 10 metres and more from the camera are pure white (colour value 255), with a linear transition from black to white in between.

By dragging the slider control with the mouse, you can define how far away from the camera you want it to be pure white or pure black, and even swap the left and right positions of the black and white controls so that the near side is white and the far side is black.

Non-Linear Slider

To accommodate scenes of different sizes, the Z depth distance slider bar is non-linear, and the following figure gives the approximate distance scale in metres.

The values are for reference only. For actual use, the position of the black-and-white slider scale should be determined according to the preview content of the screen.

Specific operations

  1. Take the demo scene as an example, after turning on the Stylized Z Depth switch, the preview screen is grey without content, because all the models in the scene are more than 10m away from the camera by default, so they are all white; at the same time, the Z Depth screen in the viewport is affected by the exposure and other post-processing parameters, so it looks like grey.

  1. At this time, we just need to pull the white dot slider to the right and define the white dot as a further distance, then we can include the whole scene into the Z depth map, this process is previewed in real time, which very intuitive:

Additional Documentation: How to use Z Depth Map in other post-production software?

Here is an example of using Photoshop, a popular compositing software, to show the process of using Z Depth Maps to create depth-of-field effects in post-production.

  1. Preview Z Depth

The scene as shown in the image:

Turn on the "Z Depth" switch in Effect>Style to adjust the distance between the black and white dots to make both the foreground and background objects appear in the preview view:

  1. Output result image and Z Depth map

Turn off the Z Depth switch and enter the output mode

In the bottom panel use the scroll wheel, find the channel option, select the Z depth channel and render the image

The rendered results are the following two images:

  1. Associate the Z depth map with the resultant image

Just drag the two images into Photoshop and juxtapose them like this:

Ctrl+A selects the Z depth map entirely and Ctrl+C copies the Z depth information to the clipboard:

In the result image file, click the "Channels" tab, create a new channel, Ctrl+V, and copy the Z depth information to the new channel "Alpha 1":

Left-click on the space indicated by the red circle and select the RGB channel.

At this point, the Z Depth information is recorded in the "Alpha 1" channel of the resultant image.

  1. Adjust the depth of field effect Select the results layer and in the Filter menu, find Blur > Lens Blur:

Set the Depth Map Source to our pre-written "Alpha 1" channel

The value range of the Blur Focus parameter is 0-255, which corresponds to 0-255 of the Z Depth map colour value, and the Blur Focus is set to whatever greyscale, and what Z Depth objects do not produce blurring, and shown to be in sharp focus.

We can widen the aperture radius to get a more intense depth of field blur effect (consistent with real-life experience):

It is very intuitive and convenient to click on the Set Focal point tool to define the object in focus by clicking directly on it on the screen:

Last updated