ZMerge

Merges input images together at their appropriate 3D depths. It does this by setting each output pixel to the input with the closest Z depth value. Z depth values are usually stored in a separate depth channel (for example, depth.z) and determine the placing of objects within the field of view of the camera. By default, ZMerge considers smaller Z depth values (darker areas) to be closer to the camera and larger values (lighter areas) further away, but you can invert this behavior.

You can use ZMerge as an alternative to creating holdout geometry, but note that you may get poor results or have problems with anti-aliasing if your input images include transparent areas or motion blur.

See also Deep Nodes.

Inputs and Controls

Connection Type

Connection Name

Function

Input

[numbered inputs]

Images to merge together based on their Z depth values.

Each input should include a Z depth channel describing the depth of the objects in that image. ZMerge merges the depth channels from all inputs and uses the result to determine what input each output pixel should come from.

Control (UI)

Knob (Scripting)

Default Value

Function

ZMerge Tab

Z channel

N/A

enabled

Enables the associated Z channel to the right. Disabling this checkbox is the same as setting the channel to none.

z_channel

depth.Z

The channel with the Z depth values. This should be the same for each input. For example, if you are merging two inputs, both data streams should have a Z depth channel in the channel specified here.

smaller Z = further away

backwards

disabled

When enabled, darker Z values are further away and hidden by lighter Z values. This is correct for Nuke and Pixar’s RenderMan renderer, which output 1/distance.

When disabled, lighter Z values are further away and hidden by darker Z values.

Alpha channel

N/A

enabled

Enables the associated alpha channel to the right. Disabling this checkbox is the same as setting the channel to none.

alpha_channel

rgba.alpha

When enabled, ZMerge uses the inputs’ alpha channels to blend between the foreground and background. You may want to check this if your input elements have alpha channels and you have a depth map that covers the entire scene (rather than just the individual elements).