KeyMix

From RMIT Visual Effects
Jump to: navigation, search

KeyMix takes two images and layers them together according to a third input (it is one of the few Nuke nodes with three inputs). It can be used to lay a background over a foreground using the output of a keyer. The only disadvantage to this method is that it outputs an image with no alpha (not a deal killer but sometimes a bore).

As well as functioning as a layering node, it can also be used to integrate two color operations with one mask. This guards against 'recycled masks'. In the image below two color operations were masked using the same oval (one was inverted). The result produces unpleasant artifacting around the edge (code below).

A poor quality mix of keys, showing artifacting around the edge

Below: this same color operation uses the KeyMix node to mask the two together. As it is only one masking operation, the results look good.

A good quality mix of keys, showing lack of artifacting

Here is the script snippet that produced these results:

Press 'Expand' and select and copy everything below this line, then paste into the Nuke node graph.

set cut_paste_input [stack 0]
version 9.0 v7
BackdropNode {
 inputs 0
 name "BAD METHOD"
 tile_color 0x87854701
 gl_color 0x87854701
 label "BAD METHOD"
 note_font "Arial Black"
 note_font_size 20
 selected true
 xpos -339
 ypos 305
 bdwidth 548
 bdheight 391
}
BackdropNode {
 inputs 0
 name "GOOD METHOD"
 tile_color 0x87854701
 gl_color 0x87854701
 label "GOOD METHOD"
 note_font "Arial Black"
 note_font_size 20
 selected true
 xpos -1107
 ypos 282
 bdwidth 616
 bdheight 449
}
push $cut_paste_input
Reformat {
 format "1920 1080 0 0 1920 1080 1 HD_1080"
 name Reformat4
 selected true
 xpos -159
 ypos 454
}
Radial {
 area {195 120 1665 920}
 softness 0.25
 name Radial7
 selected true
 xpos -159
 ypos 498
}
set N1e81b280 [stack 0]
push $N1e81b280
CheckerBoard2 {
 inputs 0
 format "1920 1080 0 0 1920 1080 1 HD_1080"
 name CheckerBoard1
 selected true
 xpos -319
 ypos 385
}
Multiply {
 inputs 1+1
 value {0.04333333671 0.1299999952 0.1299999952 1}
 invert_mask true
 name Multiply2
 selected true
 xpos -319
 ypos 457
}
Multiply {
 inputs 1+1
 value 0
 name Multiply3
 selected true
 xpos -319
 ypos 532
}
Write {
 name Write1
 selected true
 xpos -319
 ypos 753
}
StickyNote {
 inputs 0
 name StickyNote3
 label "The task is to use one mask to 'power' two different \neffects. If this is done the 'wrong' way, then artifacts \nmay result. "
 note_font_size 30
 selected true
 xpos -756
 ypos 77
}
StickyNote {
 inputs 0
 name StickyNote2
 label "Here the two Multiplies are applied to the entire image. \nA Keymix has been used to mask one result against another. "
 selected true
 xpos -790
 ypos 403
}
StickyNote {
 inputs 0
 name StickyNote1
 label "Here a mask has been applied to the first Multiply\nand an invert of that mask has been applied to the second Multiply.\nThe results demonstrates interference between the two."
 selected true
 xpos -118
 ypos 557
}
Reformat {
 inputs 0
 format "1920 1080 0 0 1920 1080 1 HD_1080"
 name Reformat5
 selected true
 xpos -1087
 ypos 609
}
Radial {
 area {195 120 1665 920}
 softness 0.25
 name Radial9
 selected true
 xpos -1087
 ypos 653
}
CheckerBoard2 {
 inputs 0
 format "1920 1080 0 0 1920 1080 1 HD_1080"
 name CheckerBoard2
 selected true
 xpos -920
 ypos 362
}
set N11efba20 [stack 0]
Multiply {
 value 0
 name Multiply4
 selected true
 xpos -837
 ypos 516
}
push $N11efba20
Multiply {
 value {0.04333333671 0.1299999952 0.1299999952 1}
 invert_mask true
 name Multiply5
 selected true
 xpos -995
 ypos 513
}
Keymix {
 inputs 3
 name Keymix1
 selected true
 xpos -919
 ypos 653
}
Write {
 name Write2
 selected true
 xpos -919
 ypos 825
}
Viewer {
 frame_range 1-100
 name Viewer1
 selected true
 xpos -943
 ypos 1040
}