Merge

The merge node in nuke is used to combine data from two separate streams. It is basically a visual representation of layering images together. Since merging images together can be done in many different ways, the merge node has a variety of operations.

merge1
Merge Node Parameters
merging operations.jpg
All Merge Operations

There are actually 30 in total but I’m only going to talk about the main 4 that I’ll be using in my project as well as the settings that I will actually make use of in the node.

Plus

I may also go into this in other posts, but for the rebuilding of the CG, I will mainly use the plus merge operation. This is literally just the A input + the B input in all channels. This is how it works with CG as all of the different passed added on top of each other will recreate the beauty render.

However, this also adds the alpha channel on top of its self each time so you could end up with an alpha value of 5 like I did at the end of my rebuild. This also affects the edges of the alpha mask, as each time it adds the slightly transparent edge pixels on top of its self it’s value increases, therefore hardening the edge. This can be fixed within all of the merge nodes by turning off the alpha channel on the a input of all of the plus merge nodes.

turning off alpha in merge

But I’m going to just copy the original alpha back onto the CG at the end of the merging just in case.

Multiply and Divide

Multiply and Divide are the again doing those exact mathematical operations. In the case of my project, they are used to further separate the direct_diffuse CG pass into an albedo and diffuse_light pass for grading.

Over

The final and default operation is Over. Over is completing this operation: A+B(1-a). This may seem strange as there is a little ‘a’ as well as a big ‘A’. The little a represents the alpha channel of the A input. If I use the actual maths operations in nuke, I can remake the over operation:

mergeOperationExpanded2

Both the left and right version produce this exact same output. This mathematical operation is basically cutting out a circular hole in B, (using the inverse of the A alpha) and is then adding the RGB of A back on top to put the color wheel over the checkerboard.

result.JPG

This operation requires a premultiplied A input to work, as the final plus will be adding data over the edge of the cut out created by the B(1-a). If the alpha was transparent in any areas, an unpremultiplied input would result in incorrect colors throughout.

Other parts of the node

mask

The merge node also has a mask input which is useful to localize the effect of the merge to a certain area such as, perhaps using id masks from Maya.

bbox

The bounding box section in the node is also very useful for optimizing the script. If the bounding box becomes large during an area of roto or transformation, for example, it will take longer to render anything as it is also computing the pixels that are in that bounding box. By setting the bounding box to the correct sized input, it will cut off the unwanted bounding box area, therefore optimizing the script.

Leave a comment