Ultimerge

Thumbnail for Ultimerge
Gizmo1/13/2025

Ultimerge is the perfect solution for blending edges of a foreground element with its background. Taken a step beyond a simple light wrap, this node wraps colour, and subtly grades the edges towards its background.

Ultimerge is the perfect solution for blending edges of a foreground element with its background. Taken a step beyond a simple light wrap, this node wraps colour, and subtly grades the edges towards its background.

set cut_paste_input [stack 0]
version 12.1 v4
push $cut_paste_input
Group {
name Ultimerge
tile_color 0x421010ff
selected true
xpos -1140
ypos 1066
addUserKnob {20 User l Ultimerge}
addUserKnob {26 blendEdges l "Blend Edges"}
addUserKnob {41 size T Blur1.size}
addUserKnob {41 mix_1 l mix T matchEdges.mix}
addUserKnob {26 color l "Bleed Color"}
addUserKnob {41 size_1 l size T Group2.size}
addUserKnob {7 color_amount l amount}
color_amount 1
addUserKnob {26 wa l "Wrap All"}
addUserKnob {41 size_2 l size T Group1.size}
addUserKnob {41 mix_2 l mix T wrap.mix}
addUserKnob {26 ""}
addUserKnob {6 effectOnly l "effect only" +STARTLINE}
addUserKnob {26 ""}
addUserKnob {26 lbl l "" t "v1.0 Jan 23, 2019 - Created\nv1.1 Jan 23. 2019 - Fixed Channels\nv1.2 Jan 24. 2019 - Added log, regular over\nv1.3 Mar 12, 2019 - Added Merge Options\nv1.4 Mar 14, 2019 - Removed Merging, only affects fg" +STARTLINE T "Ultimerge v1.3"}
addUserKnob {22 btn l DerekVFX.ca T "nuke.tcl('start', 'https://derekvfx.ca')" +STARTLINE}
}
Input {
inputs 0
name FG
xpos 148
ypos -505
}
AddChannels {
channels alpha
name AddChannels1
xpos 148
ypos -337
}
Dot {
name Dot6
note_font_size 40
xpos 182
ypos -219
}
set Ndda2800 [stack 0]
Dot {
name Dot10
note_font_size 40
xpos 182
ypos -47
}
set Ndda2400 [stack 0]
Unpremult {
name Unpremult1
xpos 148
ypos 84
}
set Ndda2000 [stack 0]
Dot {
name Dot9
note_font_size 40
xpos 391
ypos 88
}
Dot {
name Dot14
note_font_size 40
xpos 391
ypos 980
}
set Nddcf800 [stack 0]
Input {
inputs 0
name mask
xpos 23
ypos 1018
number 2
}
push $Ndda2800
Invert {
name Invert1
xpos -382
ypos -229
}
Input {
inputs 0
name BG
xpos -183
ypos -413
number 1
}
Shuffle {
alpha white
name Shuffle1
label "\[value in]"
xpos -183
ypos -125
}
set Nddce800 [stack 0]
Colorspace {
colorspace_out AlexaV3LogC
name Colorspace3
xpos -312
ypos -119
}
set Cddce400 [stack 0]
Copy {
inputs 2
from0 rgba.alpha
to0 rgba.alpha
name Copy1
xpos -382
ypos -65
}
Premult {
name Premult2
xpos -382
ypos 31
}
Dot {
name Dot5
note_font_size 40
xpos -348
ypos 103
}
set Nddf3800 [stack 0]
Dot {
name Dot4
note_font_size 40
xpos -533
ypos 103
}
Group {
name Group1
xpos -567
ypos 300
addUserKnob {20 User}
addUserKnob {41 size T Blur2.size}
}
Input {
inputs 0
name Input1
xpos -796
ypos -148
}
Dot {
name Dot2
note_font_size 40
xpos -762
ypos -61
}
set Nddf2c00 [stack 0]
Blur {
channels rgba
size {{parent.Blur2.size*16}}
name Blur6
xpos -796
ypos 50
}
push $Nddf2c00
Blur {
channels rgba
size {{parent.Blur2.size*8}}
name Blur5
xpos -900
ypos 49
}
push $Nddf2c00
Blur {
channels rgba
size {{parent.Blur2.size*4}}
name Blur4
xpos -1010
ypos 42
}
push 0
push $Nddf2c00
Blur {
channels rgba
size {{parent.Blur2.size*2}}
name Blur3
xpos -1092
ypos 46
}
push $Nddf2c00
push $Nddf2c00
Blur {
inputs 1+1
channels rgba
size 5.3
name Blur2
xpos -1179
ypos 49
}
Merge2 {
inputs 5+1
operation under
bbox B
name Merge2
xpos -796
ypos 195
}
Output {
name Output1
xpos -796
ypos 258
}
end_group
Dot {
name Dot2
note_font_size 40
xpos -533
ypos 928
}
push $Nddf3800
Group {
name Group2
xpos -382
ypos 298
addUserKnob {20 User}
addUserKnob {41 size T Blur2.size}
}
Input {
inputs 0
name Input1
xpos -796
ypos -148
}
Dot {
name Dot2
note_font_size 40
xpos -762
ypos -61
}
set Nde1e400 [stack 0]
Blur {
channels rgba
size {{parent.Blur2.size*16}}
name Blur6
xpos -796
ypos 50
}
push $Nde1e400
Blur {
channels rgba
size {{parent.Blur2.size*8}}
name Blur5
xpos -900
ypos 49
}
push $Nde1e400
Blur {
channels rgba
size {{parent.Blur2.size*4}}
name Blur4
xpos -1010
ypos 42
}
push 0
push $Nde1e400
Blur {
channels rgba
size {{parent.Blur2.size*2}}
name Blur3
xpos -1092
ypos 46
}
push $Nde1e400
push $Nde1e400
Blur {
inputs 1+1
channels rgba
size 4
name Blur2
xpos -1179
ypos 49
}
Merge2 {
inputs 5+1
operation under
bbox B
name Merge2
xpos -796
ypos 195
}
Output {
name Output1
xpos -796
ypos 258
}
end_group
Clamp {
channels rgba
minimum 0.001
maximum 100
name Clamp1
xpos -382
ypos 486
}
Expression {
expr0 (1/(r*.3+g*.59+b*.11))*r
expr1 (1/(r*.3+g*.59+b*.11))*g
expr2 (1/(r*.3+g*.59+b*.11))*b
name Expression2
xpos -382
ypos 616
}
set Nde4e000 [stack 0]
Dot {
name Dot3
note_font_size 40
xpos -348
ypos 785
}
push $Nde4e000
push $Ndda2400
Dot {
name Dot11
note_font_size 40
xpos 45
ypos -47
}
set Ndeb9800 [stack 0]
push $Nddce800
Merge2 {
inputs 2
operation stencil
bbox B
name Merge3
xpos -183
ypos -51
}
Colorspace {
colorspace_out AlexaV3LogC
name Colorspace1
xpos -183
ypos 52
}
set Cdeb9000 [stack 0]
Blur {
channels rgba
size 100
name Blur1
label "\[value size] px"
xpos -183
ypos 78
}
set Cdeb8c00 [stack 0]
Colorspace {
colorspace_in AlexaV3LogC
name Colorspace2
xpos -183
ypos 116
}
set Cdeb8800 [stack 0]
Unpremult {
name Unpremult2
xpos -183
ypos 159
}
set Ndeb8400 [stack 0]
Expression {
expr3 4*(1-a)*a
name Expression1
label "\[knob expr3]"
xpos -183
ypos 254
}
Dot {
name Dot8
note_font_size 40
xpos -149
ypos 333
}
push $Ndeb8400
push $Ndeb9800
clone $Cdeb9000 {
xpos 11
ypos 47
selected false
}
clone $Cdeb8c00 {
xpos 11
ypos 73
selected false
}
clone $Cdeb8800 {
xpos 11
ypos 111
selected false
}
Unpremult {
name Unpremult3
xpos 11
ypos 164
}
Merge2 {
inputs 2
operation divide
bbox B
output {rgba.red rgba.green rgba.blue -rgba.alpha}
name Merge4
xpos 11
ypos 215
}
push $Ndda2000
Merge2 {
inputs 2+1
operation multiply
bbox B
output {rgba.red rgba.green rgba.blue -rgba.alpha}
mix 0.304
name matchEdges
xpos 148
ypos 329
}
clone $Cddce400 {
xpos 148
ypos 389
selected true
}
Dot {
name Dot7
note_font_size 40
xpos 182
ypos 442
}
set Ndf27c00 [stack 0]
Dot {
name Dot12
note_font_size 40
xpos 59
ypos 442
}
Saturation {
saturation {{-parent.color_amount+1}}
name Saturation1
xpos 25
ypos 543
}
Merge2 {
inputs 2
operation multiply
bbox B
output {rgba.red rgba.green rgba.blue -rgba.alpha}
mix {{parent.color_amount}}
name Merge6
xpos 25
ypos 616
}
push $Ndf27c00
Keymix {
inputs 3
channels rgb
bbox B
name bleedColor
xpos 148
ypos 781
}
Merge2 {
inputs 2
bbox B
output {rgba.red rgba.green rgba.blue -rgba.alpha}
mix 0.274
name wrap
xpos 148
ypos 924
}
Colorspace {
colorspace_in AlexaV3LogC
name Colorspace5
xpos 148
ypos 966
}
push $Nddcf800
Dot {
name Dot13
note_font_size 40
xpos 292
ypos 980
}
Dissolve {
inputs 2+1
channels rgb
which 1
name Dissolve1
label "\[value which]"
xpos 148
ypos 1103
}
set Ndf53c00 [stack 0]
Merge2 {
inputs 2
operation from
bbox B
output {rgba.red rgba.green rgba.blue -rgba.alpha}
name Merge1
xpos 357
ypos 1109
}
Dot {
name Dot1
note_font_size 40
xpos 391
ypos 1190
}
push $Ndf53c00
Switch {
inputs 2
which {{effectOnly}}
name Switch1
label "\[value which]"
xpos 148
ypos 1180
}
Premult {
name Premult3
xpos 148
ypos 1264
}
Output {
name Output1
xpos 148
ypos 1343
}
end_group