The "over" Merge Node
- Ximena
- 11 jul 2023
- 3 Min. de lectura

The Merge node is a fundamental tool used for compositing images together. It combines multiple input images based on mathematical operations to produce a single output image. The math behind the Merge node mainly focuses on blending the input images using various modes and controlling their transparency or opacity.
Here's a general overview of how the math of the Merge node works:
1. Input Images: The Merge node takes two or more input images, usually called the "foreground" and "background" images. These input images can be connected to the Merge node using the node graph interface in Nuke.
2. Alpha Channels: Each input image has an associated alpha channel, which defines the transparency or opacity of each pixel in the picture. The alpha channel ranges from 0 (completely transparent) to 1 (completely opaque). The alpha channel determines how the foreground and background images are blended.
3. Blending Modes: The Merge node offers different blending modes, which mathematically define how the foreground and background images are combined. Standard blending modes include Over, Multiply, Screen, Add, and many more. Each blending mode has a unique mathematical formula to determine the resulting pixel values.
4. Pixel Computation: For each pixel in the output image, the Merge node applies the selected blending mode's mathematical formula using the pixel and corresponding alpha values from the foreground and background images. The formula combines the pixel and alpha values to produce the final pixel value for that location in the output image.
5. Alpha Computation: The Merge node also calculates the final alpha value for each pixel in the output image. This is done by considering the alpha values of the foreground and background images and applying the blending mode's formula to determine the resulting alpha value.
6. Resulting Image: After computing the pixel and alpha values for each location in the output image, the Merge node generates a composite image where the foreground and background images are combined according to the selected blending mode and the transparency of each pixel.
It's important to note that the Merge node in Nuke offers various additional controls, such as gain, bias, and premultiplication options, to manipulate the blending process further and control the final result.
The "Over" operation is one of the most commonly used blending modes in the Merge node of Foundry Nuke. It combines the foreground and background images based on their alpha channels to create a composite image. Here's how the math of the "Over" operation in the Merge node works:
1. Input Images: The Merge node takes two input images—the foreground image (F) and the background image (B)—each with their respective alpha channels (AF and AB).
2. Pixel Calculation: For each pixel in the output image, the "Over" operation is computed as follows:
- The alpha values (AF and AB) of the foreground and background images are used to calculate the final pixel's transparency or opacity. The resulting alpha value (AO) is determined by the equation AO = AF + (1 - AF) * AB. This equation ensures that the transparency of the final pixel is influenced by both the transparency of the foreground image and the opacity of the background image.
- The RGB channels of the output pixel are calculated using the equation:
RO = (RF * AF + RB * (1 - AF) * AB) / AO
GO = (GF * AF + GB * (1 - AF) * AB) / AO
BO = (BF * AF + BB * (1 - AF) * AB) / AO
Where RF, GF, and BF represent the foreground image's red, green, and blue values, and RB, GB, and BB represent the corresponding values of the background image.
3. Resulting Image: The above calculations are performed for each pixel in the output image, resulting in a composite image where the foreground image is blended over the background image based on its alpha channels.
The "Over" operation ensures that the transparency of the foreground image affects the final image's transparency. In contrast, the colour values of both images contribute to the resulting pixel's colour, with the foreground image having a more substantial influence.




Comentarios