#! /Applications/Nuke6.3v4/NukeX6.3v4.app/../Nuke6.3v4.app/Contents/MacOS/Nuke6.3v4 -nx
version 6.3 v4
Gizmo {
 help "This node provides PIK a color reference in which to base its keying algorithm on a per pixel basis.\nThe idea is to remove the foreground image and only leave the shades and hues of the original blue/greenscreen.\nAttach the output of this node to the 'c' input of a default PIK. Attach the input of this node along with the 'fg' input of the PIK to the original screen.\nPick which color your screen type is in both nodes and then while viewing the alpha output from the PIK lower the darks.b (if a bluescreen - adjust darks.g if a greenscreen) in this node \nuntil you see a change in the garbage area of the matte. Once you see a change then you have gone too far -back off a step. If you are still left with discolored edges you can use the other colors in the lights and darks to eliminate them. Remember the idea is \nto be left with the original shades of the screen and the foreground blacked out. While swapping between viewing the matte from the PIK and the rgb output of this PIKColor adjust the other colors \nuntil you see a change in the garbage area of the matte. Simple rule of thumb - if you have a light red discolored area increase the lights.r - if you have a dark green discolored area increase darks.g. If your screen does not have a very saturated hue you may still be left\n with areas of discoloration after the above process. The 'erode' slider can help with this - while viewing the rgb output adjust the erode until those areas disappear.\nThe 'patch black' slider allows you to fill in the black areas with screen color. This is not always necessary but if you see blue squares in your composite increase this value and it'll fix it.\nThe above is the only real workflow for this node - working from the top parameter to the bottom parameter- going back to tweak darks/lights with 'erode' and 'patch black' activated isn't really gonna work. "
 tile_color 0x990000
 addUserKnob {20 "" l Parameters}
 addUserKnob {4 screen l "Screen Type" M {Green Blue}}
 screen Blue
 addUserKnob {16 Size t "size of color expansion" R 0 100}
 Size 10
 addUserKnob {18 off l Darks t "adjust the color values to get the best separation between black and the screen type color.\nYou want to be left with only shades of the screen color and black. \nIf a green screen is selected start by bringing down darks->green\nIf a blue screen is selected start by bringing down darks->blue" R -1 1}
 off {0 0 0}
 addUserKnob {6 off_panelDropped l "panel dropped state" -STARTLINE +HIDDEN}
 addUserKnob {18 mult l Lights t "adjust the color values to get the best separation between black and the screen type color.\nYou want to be left with only shades of the screen color and black. \nIf a green screen is selected start by bringing down darks->green\nIf a blue screen is selected start by bringing down darks->blue" R 0 2}
 mult {1 1 1}
 addUserKnob {6 mult_panelDropped l "panel dropped state" -STARTLINE +HIDDEN}
 addUserKnob {26 ""}
 addUserKnob {7 erode l Erode t "increase this value if you still see traces of the foreground edge color in the output" R 0 5}
 addUserKnob {26 ""}
 addUserKnob {7 multi l "Patch Black" t "increase this to optionally remove the black from the output.\nThis should only be used once the the above darks/lights have been set" R 0 5}
 addUserKnob {6 filt l Filter -STARTLINE}
 filt true
 addUserKnob {26 ""}
 addUserKnob {7 level l Level t "multiply the rgb output. Helps remove noise from main key"}
 level 1
}
 Input {
  inputs 0
  name Input1
  xpos -31
  ypos -45
 }
 Dot {
  name Dot16
  xpos 3
  ypos -21
 }
set N1919d910 [stack 0]
 Dot {
  name Dot1
  tile_color 0x9597bf00
  xpos -94
  ypos -21
 }
 OFXnet.sf.openfx.gradeplugin_v2 {
  NatronOfxParamProcessR true
  NatronOfxParamProcessG true
  NatronOfxParamProcessB true
  NatronOfxParamProcessA false
  blackPoint 0
  whitePoint 1
  black 0
  white 1
  multiply {{mult.r} {mult.g} {mult.b} 0}
  offset {{off.r} {off.g} {pff.b} 0}
  gamma 1
  clampBlack true
  clampWhite false
  premult false
  premultChannel A
  maskInvert false
  mix 1
  premultChanged false
  MaskChannel -rgba.alpha
  name Grade11
  xpos -128
  ypos 34
 }
 OFXnet.sf.openfx.clamp_v2 {
  NatronOfxParamProcessR true
  NatronOfxParamProcessG true
  NatronOfxParamProcessB true
  NatronOfxParamProcessA true
  minimum 0
  minimumEnable true
  maximum 1
  maximumEnable false
  minClampTo 0
  minClampToEnable false
  maxClampTo 1
  maxClampToEnable false
  premult false
  premultChannel A
  maskInvert false
  mix 1
  premultChanged true
  MaskChannel -rgba.alpha
  name Clamp2
  xpos -128
  ypos 92
 }
set N191a4330 [stack 0]
push $N191a4330
push $N191a4330
 OFXnet.sf.openfx.pik_v1 {
  inputs 3
  screenType {{screen}}
  color {0 0 1}
  redWeight 1
  blueGreenWeight 1
  alphaBias 0.5
  despillBias 0.5
  despillBiasIsAlphaBias true
  lmEnable false
  level 1
  luma 0
  llEnable false
  autolevels false
  yellow false
  cyan false
  magenta false
  ss true
  clampAlpha true
  rgbal false
  "Screen Matte" 0
  screenClipMin 0
  screenClipMax 1
  screenReplace "Soft Color"
  screenReplaceColor 0.5
  "Inside Mask" 0
  sourceAlphaHandling Ignore
  insideReplace "Soft Color"
  insideReplaceColor 0.5
  noKey false
  ubl false
  ubc false
  colorspace "Rec. 709"
  show Premultiplied
  name PIK2
  xpos -128
  ypos 190
 }
 OFXnet.sf.openfx.invert_v2 {
  NatronOfxParamProcessR false
  NatronOfxParamProcessG false
  NatronOfxParamProcessB false
  NatronOfxParamProcessA true
  premult false
  premultChannel A
  maskInvert false
  mix 1
  premultChanged true
  MaskChannel -rgba.alpha
  name Invert1
  xpos -18
  ypos 190
 }
 OFXeu.cimg.erodeblur_v4 {
  NatronOfxParamProcessR false
  NatronOfxParamProcessG false
  NatronOfxParamProcessB false
  NatronOfxParamProcessA true
  size {{erode}}
  blur 0
  expandRoD true
  premult false
  premultChannel A
  maskInvert false
  mix 1
  premultChanged false
  MaskChannel -rgba.alpha
  name Erode1
  xpos -18
  ypos 223
 }
set N191b1c00 [stack 0]
 Dot {
  name Dot3
  tile_color 0x9597bf00
  xpos 16
  ypos 684
 }
push $N191b1c00
push $N1919d910
 Dot {
  name Dot17
  xpos 126
  ypos -21
 }
 Copy {
  inputs 2
  from0 rgba.alpha
  to0 rgba.alpha
  channels alpha
  name Copy3
  tile_color 0x9e3c6300
  xpos 92
  ypos 179
 }
 OFXnet.sf.openfx.premult_v2 {
  NatronOfxParamProcessR true
  NatronOfxParamProcessG true
  NatronOfxParamProcessB true
  NatronOfxParamProcessA false
  premultChannel A
  premultChanged false
  name Premult3
  xpos 92
  ypos 235
 }
set N191ba840 [stack 0]
 OFXnet.sf.cimg.cimgblur_v4 {
  NatronOfxParamProcessR true
  NatronOfxParamProcessG true
  NatronOfxParamProcessB true
  NatronOfxParamProcessA true
  size {{Size}}
  uniform true
  orderX 0
  orderY 0
  boundary Black
  filter Quadratic
  expandRoD false
  alphaThreshold 0
  premult false
  premultChannel A
  maskInvert false
  mix 1
  premultChanged false
  MaskChannel -rgba.alpha
  name Blur4
  xpos 92
  ypos 267
 }
 OFXnet.sf.openfx.unpremult_v2 {
  NatronOfxParamProcessR true
  NatronOfxParamProcessG true
  NatronOfxParamProcessB true
  NatronOfxParamProcessA false
  premultChannel A
  premultChanged false
  name Unpremult4
  xpos 90
  ypos 300
 }
set N191c1b60 [stack 0]
 OFXnet.sf.openfx.clamp_v2 {
  NatronOfxParamProcessR true
  NatronOfxParamProcessG true
  NatronOfxParamProcessB true
  NatronOfxParamProcessA true
  minimum 0
  minimumEnable true
  maximum 0
  maximumEnable true
  minClampTo 0
  minClampToEnable true
  maxClampTo 1
  maxClampToEnable true
  premult true
  premultChannel A
  maskInvert false
  mix 1
  premultChanged false
  MaskChannel -rgba.alpha
  name Clamp1
  xpos 212
  ypos 301
 }
set N191c4ab0 [stack 0]
 Dot {
  name Dot5
  xpos 366
  ypos 304
 }
push $N191c4ab0
push $N191c1b60
 Dot {
  name Dot4
  xpos 126
  ypos 349
 }
 Copy {
  inputs 2
  from0 rgba.red
  to0 rgba.alpha
  name Copy1
  xpos 212
  ypos 338
 }
set N191caea0 [stack 0]
 Blur {
  channels rgba
  size {{Size*3*multi}}
  filter quadratic
  name Blur1
  xpos 212
  ypos 390
 }
 OFXnet.sf.openfx.unpremult_v2 {
  NatronOfxParamProcessR true
  NatronOfxParamProcessG true
  NatronOfxParamProcessB true
  NatronOfxParamProcessA false
  premultChannel A
  premultChanged false
  name Unpremult1
  xpos 212
  ypos 425
 }
 Copy {
  inputs 2
  from0 rgba.red
  to0 rgba.alpha
  name Copy2
  xpos 332
  ypos 421
 }
 OFXnet.sf.openfx.invert_v2 {
  NatronOfxParamProcessR false
  NatronOfxParamProcessG false
  NatronOfxParamProcessB false
  NatronOfxParamProcessA true
  premult false
  premultChannel A
  maskInvert false
  mix 1
  premultChanged true
  MaskChannel -rgba.alpha
  name Invert2
  xpos 334
  ypos 477
 }
set N1ba5ba00 [stack 0]
 OFXnet.sf.cimg.cimgerode_v2 {
  NatronOfxParamProcessR false
  NatronOfxParamProcessG false
  NatronOfxParamProcessB false
  NatronOfxParamProcessA true
  size {{(-Size/5)} {(-Size/5)}}
  expandRoD false
  premult false
  premultChannel A
  maskInvert false
  mix 1
  premultChanged true
  name ErodeFast2
  xpos 334
  ypos 535
 }
 OFXnet.sf.cimg.cimgblur_v4 {
  NatronOfxParamProcessR false
  NatronOfxParamProcessG false
  NatronOfxParamProcessB false
  NatronOfxParamProcessA true
  size {{(Size/5)*2} {(Size/5)*2}}
  uniform true
  orderX 0
  orderY 0
  boundary Black
  filter Box
  expandRoD false
  alphaThreshold 0
  premult false
  premultChannel A
  maskInvert false
  mix 1
  premultChanged false
  name BlurCImg2
  selected true
  xpos 334
  ypos 578
 }
push $N1ba5ba00
 OFXnet.sf.cimg.cimgerode_v2 {
  NatronOfxParamProcessR false
  NatronOfxParamProcessG false
  NatronOfxParamProcessB false
  NatronOfxParamProcessA true
  size {{(-Size/5)*multi*2} {(-Size/5)*multi*2}}
  expandRoD false
  premult false
  premultChannel A
  maskInvert false
  mix 1
  premultChanged true
  name ErodeFast1
  xpos 217
  ypos 477
 }
 OFXnet.sf.cimg.cimgblur_v4 {
  NatronOfxParamProcessR false
  NatronOfxParamProcessG false
  NatronOfxParamProcessB false
  NatronOfxParamProcessA true
  size {{(Size/5)*multi*4} {(Size/5)*multi*4}}
  uniform true
  orderX 0
  orderY 0
  boundary Black
  filter Box
  expandRoD false
  alphaThreshold 0
  premult false
  premultChannel A
  maskInvert false
  mix 1
  premultChanged false
  name BlurCImg1
  xpos 217
  ypos 513
 }
 Switch {
  inputs 2
  which {{1-filt}}
  name Switch1
  xpos 217
  ypos 578
 }
 OFXnet.sf.openfx.premult_v2 {
  NatronOfxParamProcessR true
  NatronOfxParamProcessG true
  NatronOfxParamProcessB true
  NatronOfxParamProcessA false
  premultChannel A
  premultChanged false
  name Premult1
  xpos 217
  ypos 616
 }
push $N191caea0
 Dot {
  name Dot2
  xpos 126
  ypos 388
 }
 OFXnet.sf.openfx.mergeplugin_v1 {
  inputs 2
  NatronOfxParamStringSublabelName over
  operation over
  bbox Union
  screenAlpha false
  AChannelsR true
  AChannelsG true
  AChannelsB true
  AChannelsA true
  BChannelsR true
  BChannelsG true
  BChannelsB true
  BChannelsA true
  OutputChannelsR true
  OutputChannelsG true
  OutputChannelsB true
  OutputChannelsA true
  maskInvert false
  mix 1
  MaskChannel -rgba.alpha
  name Merge1
  xpos 92
  ypos 616
 }
 OFXnet.sf.openfx.unpremult_v2 {
  NatronOfxParamProcessR true
  NatronOfxParamProcessG true
  NatronOfxParamProcessB true
  NatronOfxParamProcessA false
  premultChannel A
  premultChanged false
  name Unpremult5
  xpos 92
  ypos 640
 }
 Copy {
  inputs 2
  from0 rgba.alpha
  to0 rgba.alpha
  name ChannelCopy2
  tile_color 0x9e3c6300
  xpos 92
  ypos 673
 }
 OFXnet.sf.openfx.gradeplugin_v2 {
  NatronOfxParamProcessR true
  NatronOfxParamProcessG true
  NatronOfxParamProcessB true
  NatronOfxParamProcessA false
  blackPoint 0
  whitePoint 1
  black 0
  white 1
  multiply {{level}}
  offset 0
  gamma 1
  clampBlack true
  clampWhite false
  premult false
  premultChannel A
  maskInvert false
  mix 1
  premultChanged true
  MaskChannel -rgba.alpha
  name Grade1
  xpos 92
  ypos 724
 }
 Output {
  name Output1
  xpos 92
  ypos 762
 }
push $N191ba840
 Viewer {
  frame_range 1-24
  name Viewer1
  xpos 317
  ypos 175
 }
end_group
