MergeExpression

Allows you to merge two images using Tcl expressions. The syntax is the same as for the Color > Math > Expression node, except that you need to precede channel references with either A or B to indicate the input. For example, to reference the red, green, blue, and alpha channels of input A, you should use Ar, Ag, Ab, and Aa. Similarly, to reference these channels in input B, use Br, Bg, Bb, and Ba.

To reference pixels in other layers, use INPUTlayer.channel, for example Bmatte.garbage. If you don’t specify a layer, Nuke assumes the channel is in the current layer, for example Bgarbage.

For more information on the syntax for Tcl expressions, see Expressions in the Nuke or select Help > Documentation > Knob Math Expressions in Nuke.

See also Expression.

Inputs and Controls

Connection Type

Connection Name

Function

Input

A

The image sequence to merge with input B.

B

The image sequence to merge with input A.

mask

An optional image to use as a mask. By default, the merge is limited to the non-black areas of the mask.

At first, the mask input appears as triangle on the right side of the node, but when you drag it, it turns into an arrow labeled mask. If you cannot see the mask input, ensure that the mask control isn’t disabled or set to none.

Control (UI)

Knob (Scripting)

Default Value

Function

MergeExpression

[variable name field]

temp_name0

N/A

If you need to use a long expression in several fields, you can use this row for assigning the expression temporarily to a variable. Enter the variable name here, and the expression on the right of the = sign. You can then use the variable to represent the expression in the = fields next to the channels.

=

temp_expr0

N/A

If you need to use a long expression in several fields, you can use this row for assigning the expression temporarily to a variable. Enter the variable name on the left side of the = sign, and the expression in this field. You can then use the variable to represent the expression in the = fields next to the channels.

[variable name field]

temp_name1

N/A

If you need to use a long expression in several fields, you can use this row for assigning the expression temporarily to a variable. Enter the variable name here, and the expression on the right of the = sign. You can then use the variable to represent the expression in the = fields next to the channels.

=

temp_expr1

N/A

If you need to use a long expression in several fields, you can use this row for assigning the expression temporarily to a variable. Enter the variable name on the left side of the = sign, and the expression in this field. You can then use the variable to represent the expression in the = fields next to the channels.

[variable name field]

temp_name2

N/A

If you need to use a long expression in several fields, you can use this row for assigning the expression temporarily to a variable. Enter the variable name here, and the expression on the right of the = sign. You can then use the variable to represent the expression in the = fields next to the channels.

=

temp_expr2

N/A

If you need to use a long expression in several fields, you can use this row for assigning the expression temporarily to a variable. Enter the variable name on the left side of the = sign, and the expression in this field. You can then use the variable to represent the expression in the = fields next to the channels.

[variable name field]

temp_name3

N/A

If you need to use a long expression in several fields, you can use this row for assigning the expression temporarily to a variable. Enter the variable name here, and the expression on the right of the = sign. You can then use the variable to represent the expression in the = fields next to the channels.

=

temp_expr3

N/A

If you need to use a long expression in several fields, you can use this row for assigning the expression temporarily to a variable. Enter the variable name on the left side of the = sign, and the expression in this field. You can then use the variable to represent the expression in the = fields next to the channels.

channels

channel0

red

The channel(s) to which you want to apply the expression in the below = field.

You can use the checkboxes on the right to select individual channels.

=

expr0

N/A

The expression to apply to the above channels.

You need to precede channel references with either A or B to indicate the input. For example, to reference the red, green, blue, and alpha channels of input A, you should use Ar, Ag, Ab, and Aa. Similarly, to reference these channels in input B, use Br, Bg, Bb, and Ba.

To reference pixels in other layers, use INPUTlayer.channel, for example Bmatte.garbage. If you don’t specify a layer, Nuke assumes the channel is in the current layer, for example Bgarbage.

channels

channel1

green

The channel(s) to which you want to apply the expression in the below = field.

You can use the checkboxes on the right to select individual channels.

=

expr1

N/A

The expression to apply to the above channels.

You need to precede channel references with either A or B to indicate the input. For example, to reference the red, green, blue, and alpha channels of input A, you should use Ar, Ag, Ab, and Aa. Similarly, to reference these channels in input B, use Br, Bg, Bb, and Ba.

To reference pixels in other layers, use INPUTlayer.channel, for example Bmatte.garbage. If you don’t specify a layer, Nuke assumes the channel is in the current layer, for example Bgarbage.

channels

channel2

blue

The channel(s) to which you want to apply the expression in the below = field.

You can use the checkboxes on the right to select individual channels.

=

expr2

N/A

The expression to apply to the above channels.

You need to precede channel references with either A or B to indicate the input. For example, to reference the red, green, blue, and alpha channels of input A, you should use Ar, Ag, Ab, and Aa. Similarly, to reference these channels in input B, use Br, Bg, Bb, and Ba.

To reference pixels in other layers, use INPUTlayer.channel, for example Bmatte.garbage. If you don’t specify a layer, Nuke assumes the channel is in the current layer, for example Bgarbage.

channels

channel3

alpha

The channel(s) to which you want to apply the expression in the below = field.

You can use the checkboxes on the right to select individual channels.

=

expr3

N/A

The expression to apply to the above channels.

You need to precede channel references with either A or B to indicate the input. For example, to reference the red, green, blue, and alpha channels of input A, you should use Ar, Ag, Ab, and Aa. Similarly, to reference these channels in input B, use Br, Bg, Bb, and Ba.

To reference pixels in other layers, use INPUTlayer.channel, for example Bmatte.garbage. If you don’t specify a layer, Nuke assumes the channel is in the current layer, for example Bgarbage.

mask

N/A

disabled

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

maskChannelInput

none

The channel to use as a mask. By default, the merge is limited to the non-black areas of this channel.

inject

inject

disabled

Copies the mask input to the predefined mask.a channel. Injecting the mask allows you to use the same mask further downstream.

invert

invert_mask

disabled

Inverts the use of the mask channel, so that the merge is limited to the non-white areas of the mask.

fringe

fringe

disabled

When enabled, only apply the effect to the edge of the mask.

When disabled, the effect is applied to the entire mask.

(un)premult by

N/A

disabled

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

unpremult

none

The image is divided by this channel before being processed, and multiplied again afterwards.

If you are using premultiplied input images, you may want to check (un)premult by and select rgba.alpha here. This will simulate doing the merge before the premultiplication was done.

If you are using unpremultiplied input images, you should leave this set to none.

invert

invert_unpremult

disabled

Inverts the use of the (un)premultiply channel.

mix

mix

1

Dissolves between the original image at 0 and the full effect at 1.