Layering Images Together with the Merge Node
The Merge node with its compositing algorithms allows you to control just how your images are combined.
Note: When using most of the available merge algorithms, Nuke expects premultiplied input images. However, with the matte operation you should use unpremultiplied images.
To Layer Images with the Merge Node
1. | Select Merge > Merge (or press M on the Node Graph) to insert a Merge node after the images you want to layer together. |
2. | Connect your images to the Merge node’s A and B inputs. |
3. | If necessary, you can connect multiple A images to the Merge node. Once you have got the A and B inputs connected as instructed in step 2, drag more connectors from the left side of the Merge node to the images you want to use as additional A inputs. |
Each input is merged in the order connected, for example A3, A2, A1, B.
4. | Connect a Viewer to the output of the Merge node so you can see the effect of your merge operation. |
5. | In the Merge node’s controls, select how you want to layer the images together from the operation dropdown menu. The default and the most common operation is over, which layers input A over input B according to the alpha of input A. For descriptions of all the available operations, see Merge Operations. |
6. | Using the A channels and B channels dropdown menus, select which channels to use from the A and B inputs and which channels to use as the A and B alpha. If you want to merge more channels than these and output them into the same channels, select them from the also merge dropdown menus and checkboxes. |
7. | From the output dropdown menu, select the channels you want to write the merge of the A and B channels to. Channels named in the also merge dropdown menu are written to the same output channels. |
8. | If necessary, you can also adjust the following controls: |
• To select which input’s metadata to pass down the tree, use the metadata from dropdown menu.
Note: When metadata from is set to All and there are keys with the same name in both inputs, keys in B override keys in A.
For more information on file metadata, see Working with File Metadata.
• To dissolve between the original input B image (at 0) and the full Merge effect (at 1), adjust the mix slider. A small light gray square appears on the node in the node graph to indicate that the full effect is not used.
• If you want to mask the effect of the Merge operation, select the mask channel from the mask dropdown menus. To invert the mask, check invert. To only apply the effect at the edges of the mask, check fringe.
Note that you should not use the alpha of the inputs for the mask. It produces erroneous results (though the error is often hard to see); you can achieve better results by turning on alpha masking.
• From the Set BBox to dropdown menu, select how you want to output the bounding box. The default is union, which combines the two bounding boxes. You can also select intersection to set the bounding box to the area where the two bounding boxes overlap, A to use the bounding box from input A, or B to use the bounding box from input B.
• By default, Nuke assumes that images are in linear color space. However, if you want to convert colors to the default 8-bit color space defined in the LUT tab of your project settings (usually, sRGB), check Video colorspace. The conversion is done before the images are composited together, and the results are converted back to linear afterwards. Any other channels than the red, green, and blue are merged without conversion.
Checking this option can be useful if you want to duplicate the results you obtained from an application that uses the standard compositing math but applies it to non-linear images (for example, Adobe® Photoshop®). In this case, you typically also need to make sure premultiplied is not checked in your Read node controls.
• By default, the same math is applied to the alpha channel as the other channels. However, according to the PDF/SVG specification, many of the merge operations (for example, overlay and hard-light) should set the alpha to (a+b - ab). This way, the input images remain unchanged in the areas where the other image has zero alpha. If you want to enable this, check alpha masking.