Skip to content

Instantly share code, notes, and snippets.

@Shrinks99
Last active May 8, 2022 21:11
Show Gist options
  • Save Shrinks99/1c60268efc7aefacbcabd69c81e73fd5 to your computer and use it in GitHub Desktop.
Save Shrinks99/1c60268efc7aefacbcabd69c81e73fd5 to your computer and use it in GitHub Desktop.
An unfinished VHS filter for Nuke 13+
set cut_paste_input [stack 0]
version 13.1 v3
push $cut_paste_input
Group {
name hw_vhs
tile_color 0x343334ff
selected true
xpos 97
ypos 115
addUserKnob {20 tape l Tape}
addUserKnob {20 tape_chromasubsample l "Chroma Sub-Sampling" n 1}
addUserKnob {41 size_1 l "chroma blur" t "Simulates chroma subsampling" T chromaBlur.size}
addUserKnob {41 size l "luminace blur" T lumaBlur.size}
addUserKnob {20 endGroup_5 n -1}
addUserKnob {20 tape_chromaweave l "Chroma Weave" n 1}
tape_chromaweave 0
addUserKnob {41 translate l "translate Cb" T TransformCb.translate}
addUserKnob {41 translate_1 l "translate Cr" T TransformCr.translate}
addUserKnob {26 tape_chromaweave_x_divider l "X-Axis Transform" t "The X & Y axis chroma weave transforms control sine waves that move both chroma channels around while leaving the luma channel intact."}
addUserKnob {41 minVal_1 l "min value" T ChromaWeaveX.minVal}
addUserKnob {41 maxVal_1 l "max value" T ChromaWeaveX.maxVal}
addUserKnob {41 waveLength_1 l speed T ChromaWeaveX.waveLength}
addUserKnob {41 offset_1 l offset T ChromaWeaveX.offset}
addUserKnob {26 tape_chromaweave_y_divider l "Y-Axis Transform" t "The X & Y axis chroma weave transforms control sine waves that move both chroma channels around while leaving the luma channel intact."}
addUserKnob {41 minVal l "min value" T ChromaWeaveY.minVal}
addUserKnob {41 maxVal l "max value" T ChromaWeaveY.maxVal}
addUserKnob {41 waveLength l speed T ChromaWeaveY.waveLength}
addUserKnob {41 offset T ChromaWeaveY.offset}
addUserKnob {20 endGroup n -1}
addUserKnob {20 tape_rgb_offset l "RGB Offsets" n 1}
tape_rgb_offset 0
addUserKnob {41 size_2 l "blur red" T BlurRed.size}
addUserKnob {41 translate_2 l "translate red" T Offset_Red.translate}
addUserKnob {41 size_3 l "blur green" T BlurGreen.size}
addUserKnob {41 translate_3 l "translate green" T Offset_Green.translate}
addUserKnob {41 size_4 l "blur blue" T BlurBlue.size}
addUserKnob {41 translate_4 l "translate blue" T Offset_Blue.translate}
addUserKnob {20 endGroup_1 n -1}
addUserKnob {20 tape_distortion l Distortion n 1}
addUserKnob {20 endGroup_2 n -1}
addUserKnob {20 tape_noise l Noise n 1}
addUserKnob {20 endGroup_3 n -1}
addUserKnob {20 tape_wrinkle l Wrinkle n 1}
addUserKnob {20 endGroup_4 n -1}
addUserKnob {26 tape_technical_divider l "Misc Settings"}
addUserKnob {3 seed t "Sets the seed used to define randomness"}
seed 1234
addUserKnob {20 deck l Deck}
addUserKnob {7 deck_sharpen l sharpen t "Post sharpening applied by the VHS deck" R 0 100}
deck_sharpen 2
addUserKnob {6 deck_logSharpen l "Log Sharpen" t "Check this box to sharpen in log space instead. Typically you'll want to leave this off as most sharpening done by VHS decks was pretty garbage and resulted in dark edges that we usually try to avoid in comp by sharpening in log space." +STARTLINE}
addUserKnob {20 deck_color l Color n 1}
deck_color 0
addUserKnob {41 blackpoint T Grade1.blackpoint}
addUserKnob {41 saturation T Saturation1.saturation}
addUserKnob {41 mode l "luminance math" T Saturation1.mode}
addUserKnob {20 endGroup_6 n -1}
addUserKnob {20 deck_interlaceerror l "Interlace Error" n 1}
addUserKnob {7 deck_interlaceerror_speed l speed R 0 10}
deck_interlaceerror_speed 1
addUserKnob {4 deck_interlaceerror_direction l direction t "Controls the direction of travel for the interlace error lines" M {up down "" "" "" "" ""}}
deck_interlaceerror_direction down
addUserKnob {3 deck_interlaceerror_bars l bars}
deck_interlaceerror_bars 4
addUserKnob {41 size_5 l size T InterlaceErrorGrid.size}
addUserKnob {41 size_6 l blur T InterlaceErrorBlur.size}
addUserKnob {41 mix l strength T InterlaceErrorMerge.mix}
addUserKnob {20 endGroup_7 n -1}
}
BackdropNode {
inputs 0
name BackdropNode1
tile_color 0xaaaaaa00
label "yCbCr Processing"
note_font_size 42
xpos -278
ypos 203
bdwidth 796
bdheight 710
}
BackdropNode {
inputs 0
name BackdropNode2
tile_color 0x7171c600
label Sharpening
note_font_size 42
xpos -455
ypos 2011
bdwidth 573
bdheight 421
}
BackdropNode {
inputs 0
name BackdropNode3
tile_color 0x71c67100
label "Bur and Offset RGB"
note_font_size 42
xpos -357
ypos 1117
bdwidth 601
bdheight 772
}
BackdropNode {
inputs 0
name BackdropNode4
tile_color 0x8e388e00
label "Interlace Error"
note_font_size 42
xpos -690
ypos 189
bdwidth 185
bdheight 474
}
Group {
inputs 0
name ChromaWeaveY
help "Allows the easy creation of a variety of Waveform Expressions for use in manipulating knob values."
xpos 29
ypos 518
addUserKnob {20 main l Main}
addUserKnob {26 unnamed_1 l "" +STARTLINE T " "}
addUserKnob {68 type l "Wave Type" t "Controls what type of wave to generate." M {Random Noise Sine Triangle Square Sawtooth/Sawtooth "Sawtooth/Sawtooth (Parabolic)" "Sawtooth/Sawtooth (Parabolic reversed)" "Sawtooth/Sawtooth (Exponential)" Bounce "" "" "" "" ""}}
type Sine
addUserKnob {7 minVal l "Min Value" t "Minimum value you want the wave to reach." R -10 0}
addUserKnob {7 maxVal l "Max Value" t "Maximum value you want the wave to reach." -STARTLINE R 0 10}
addUserKnob {7 waveLength l WaveLength t "Controls the frequency or cycle length of the wave. The number of frames before the pattern repeats." R 0 100}
waveLength 24
addUserKnob {7 offset l Offset t "Offsets the frame value to allow control of values at a certain frame" R 0 10}
addUserKnob {26 unnamed l "" +STARTLINE T " "}
addUserKnob {22 expButton l "Generate Expression" T "node = nuke.thisNode()\ntype = node.knob('type').getValue()\nexpText = node.knob('expText')\nexpFormula = node.knob('formula')\nexpResult = node.knob('expResult')\ndef setExp():\n if type == 0: #Random\n exp = 'random((frame+%s)/%s) * (%s-%s) + %s' %(offset,waveLength,maxVal,minVal,minVal)\n if type == 1: #Noise\n exp = '(noise((frame+%s)/%s)+1)/2 * (%s-%s) + %s' %(offset,waveLength,maxVal,minVal,minVal)\n if type == 2: #Sine\n exp = '(sin(2*pi*(frame+%s)/%s)+1)/2 * (%s-%s) + %s' %(offset,waveLength,maxVal,minVal,minVal)\n if type == 3: #Triangle\n exp = '(asin(sin(2*pi*(frame+%s)/%s))/pi+0.5) * (%s-%s) + %s' %(offset,waveLength,maxVal,minVal,minVal)\n if type == 4: #Square\n exp = 'int(sin(2*pi*(frame+%s)/%s)+1) * (%s-%s) + %s' %(offset,waveLength,maxVal,minVal,minVal)\n if type == 5: #Sawtooth\n exp = '((frame+%s) %% %s)/%s * (%s-%s) + %s' %(offset,waveLength,waveLength,maxVal,minVal,minVal)\n if type == 6: #Sawtooth(Parabolic)\n exp = 'sin((4.93480220054468*(frame+%s)/(pi*%s)) %% (pi/2)) * (%s-%s) + %s' %(offset,waveLength,maxVal,minVal,minVal)\n if type == 7: #Sawtooth(Parabolic Reversed)\n exp = 'cos((4.93480220054468*(frame+%s)/(pi*%s)) %% (pi/2)) * (%s-%s) + %s' %(offset,waveLength,maxVal,minVal,minVal)\n if type == 8: #Sawtooth (Exponential)\n exp = '(exp(2*pi*((frame+%s) %% %s)/%s)-1)/exp(2*pi) * (%s-%s) + %s' %(offset,waveLength,waveLength,maxVal,minVal,minVal)\n if type == 9: #Bounce\n exp = 'abs(sin(pi*(frame + %s)/%s))* (%s-%s) + %s' %(offset,waveLength,maxVal,minVal,minVal)\n return exp\n\nwaveLength = 'waveLength'\noffset = 'offset'\nmaxVal = 'maxVal'\nminVal = 'minVal'\nexpResult.setExpression(setExp())\nexpFormula.setValue(setExp())\n\nwaveLength = node.knob('waveLength').getValue()\noffset = node.knob('offset').getValue()\nmaxVal = node.knob('maxVal').getValue()\nminVal = node.knob('minVal').getValue()\nexpText.setValue(setExp())" +STARTLINE}
addUserKnob {26 ""}
addUserKnob {7 expResult l Result t "The calculated result of the wave at the given frame. Link to this value if you want to control the expression from this node."}
expResult {{"(sin(2*pi*(frame+offset)/waveLength)+1)/2 * (maxVal-minVal) + minVal"}}
addUserKnob {26 unnamed_2 l "" +STARTLINE T " "}
addUserKnob {1 expText l Expression t "The wave in expression form. For copying to another knobs expression value."}
expText "(sin(2*pi*(frame+0.0)/10.0)+1)/2 * (0.0-0.0) + 0.0"
addUserKnob {26 unnamed_3 l "" +STARTLINE T " "}
addUserKnob {1 formula l Formula t "The formula that generates the wave."}
formula "(sin(2*pi*(frame+offset)/waveLength)+1)/2 * (maxVal-minVal) + minVal"
}
end_group
Input {
inputs 0
name Input1
xpos -244
ypos -828
}
Grade {
blackpoint -0.02
name Grade1
label "Pre-treatment grade controls"
xpos -244
ypos -767
}
Saturation {
saturation 1.1
mode Average
name Saturation1
label "Pre-treatment saturation"
xpos -244
ypos -703
}
Dot {
name Dot21
xpos -210
ypos -554
}
set N366f7400 [stack 0]
Remove {
name Remove3
xpos -36
ypos -563
}
set N366f7000 [stack 0]
Dot {
name Dot18
xpos 148
ypos -554
}
Dot {
name Dot4
xpos 148
ypos -188
}
set N366f6800 [stack 0]
Noise {
cliptype none
replace true
size 560
zoffset {{frame*parent.seed}}
lacunarity 8.4
gain 0.8
gamma 0.045
scale {32 1}
center {1024 576}
name Noise4
xpos 114
ypos -106
}
Dot {
name Dot20
xpos 148
ypos 2
}
push $N366f6800
Dot {
name Dot19
xpos 23
ypos -188
}
Noise {
cliptype none
replace true
size 1
zoffset {{frame*parent.seed}}
octaves 5
lacunarity 1.96
gain 0.85
gamma 0.045
scale {92 0.001}
center {1024 576}
name Noise2
label "High Frequency Picture Noise"
xpos -11
ypos -158
}
Dot {
name Dot16
xpos 23
ypos -81
}
push $N366f7000
Noise {
size 1
zoffset {{frame*parent.seed}}
octaves 5
lacunarity 1
gain 0.1
gamma 1
scale {5 1}
center {1024 778}
name Noise1
xpos -36
ypos -490
}
Dot {
name Dot17
xpos -2
ypos -398
}
push $N366f7400
Copy {
inputs 2
from0 rgba.red
to0 forward.u
name Copy6
xpos -244
ypos -407
}
IDistort {
uv forward
uv_scale 5.8
name IDistort1
xpos -244
ypos -366
}
Merge2 {
inputs 2
operation plus
bbox B
mix 0.025
name Merge2
xpos -244
ypos -84
}
Merge2 {
inputs 2
operation plus
mix 0.005
name Plus
xpos -244
ypos 3
disable true
}
Group {
name Grain_Advanced
help "Adds synthetic grain. \n\nThe defaults are setup to simulate an HD Alexa plate's grain.\n\nYou can adjust the sliders to match a sample piece of grain. Find a sample with a rather constant background, blur it to remove the grain, and use as input to this. View with a wipe in the viewer so you can make a match. It helps to view and match each of the red, green, blue separately."
tile_color 0x323232ff
note_font_color 0xb80045ff
xpos -244
ypos 73
addUserKnob {20 grain_tab l Grain}
addUserKnob {3 seed t "Change this value to make different instances of this operator produce different noise"}
seed 134
addUserKnob {26 "" l "@b;Size"}
addUserKnob {14 red_size l red R 0 100}
red_size 0.55
addUserKnob {14 green_size l green R 0 100}
green_size 0.4
addUserKnob {14 blue_size l blue R 0 100}
blue_size 0.8
addUserKnob {7 irregularity}
irregularity 0.355
addUserKnob {26 Intensity l "@b;Intensity Bright"}
addUserKnob {7 red_m l red t "Amount of grain to add to a white pixel"}
red_m 0.15
addUserKnob {7 green_m l green}
green_m 0.15
addUserKnob {7 blue_m l blue}
blue_m 0.2
addUserKnob {26 Darks l "@b;Intensity Darks"}
addUserKnob {7 red_i l red R 0 0.2}
red_i 0.025
addUserKnob {7 green_i l green R 0 0.2}
green_i 0.01
addUserKnob {7 blue_i l blue R 0 0.2}
blue_i 0.03
addUserKnob {26 Softness l "@b;Softness"}
addUserKnob {7 red_soft l red R 0 2}
red_soft 1.3
addUserKnob {7 green_soft l green R 0 2}
green_soft 1.1
addUserKnob {7 blue_soft l blue R 0 2}
blue_soft 1.3
addUserKnob {26 Globals l "@b;Global Controls"}
addUserKnob {7 saturation l "Grain Saturation" t "Control how saturated the grain appears"}
saturation 1
addUserKnob {7 aspect_ratio l "Aspect Ratio" t "Edit the aspect ratio of the grain to match anamorphic plates." R 0.5 2}
aspect_ratio 1
addUserKnob {4 ar_filter l " " t "Set the filter on the aspect ratio transform" -STARTLINE M {Impulse Cubic ""}}
ar_filter Cubic
addUserKnob {6 apply_alpha l "Apply only through alpha" +STARTLINE}
addUserKnob {6 invert_alpha l "Invert alpha" -STARTLINE}
addUserKnob {6 invert_mask l "Invert mask" -STARTLINE}
addUserKnob {7 mix}
mix 1
addUserKnob {26 ""}
addUserKnob {26 spin_copyright l "" t "© <b>SPIN<span style=\"color:#b32026\">VFX</span></b>\nGrain_Advanced\nVersion 1.1\n2017" +STARTLINE T "<span style=\"color:#aaa;font-family:sans-serif;font-size:8pt\"><b>SPIN<span style=\"color:#b32026\">VFX</span></b> - Version 1.1 - 2017 - <a href=\"https://github.com/SpinVFX/spin_nuke_gizmos/\" style=\"color:#aaa\">Github Page</a></span>"}
}
Input {
inputs 0
name mask
xpos 368
ypos 675
number 1
}
Input {
inputs 0
name img
xpos 34
ypos -150
}
Dot {
name Dot1
tile_color 0xcccccc00
xpos 68
ypos -58
}
set N36692c00 [stack 0]
Dot {
name Dot5
tile_color 0xcccccc00
xpos -75
ypos -58
}
set N36692800 [stack 0]
Dot {
name Dot6
tile_color 0xcccccc00
xpos -146
ypos -58
}
Dot {
name Dot7
tile_color 0xcccccc00
xpos -146
ypos 679
}
push $N36692800
Shuffle {
alpha white
name Shuffle1
xpos -109
ypos 86
disable {{parent.apply_alpha}}
}
Dot {
name Dot4
tile_color 0x9e3c6300
xpos -76
ypos 557
}
push $N36692c00
Dot {
name Dot2
tile_color 0xcccccc00
xpos 164
ypos -58
}
set N36691400 [stack 0]
Noise {
output {rgba.red -rgba.green -rgba.blue -rgba.alpha}
cliptype none
replace true
size {{parent.red_size.w} {parent.red_size.h}}
zoffset {{frame+seed+(irregularity/2)}}
octaves 2
gamma 1
xrotate {{irregularity*45}}
yrotate {{irregularity*45}}
name red
xpos 252
ypos -62
}
Noise {
output {-rgba.red rgba.green -rgba.blue -rgba.alpha}
cliptype none
replace true
size {{parent.green_size.w} {parent.green_size.h}}
zoffset {{frame+6+seed+(irregularity/2)}}
octaves 2
gamma 1
xrotate {{irregularity*45}}
yrotate {{irregularity*45}}
name green
xpos 252
ypos -19
}
Noise {
output {-rgba.red -rgba.green rgba.blue -rgba.alpha}
cliptype none
replace true
size {{parent.blue_size.w} {parent.blue_size.h}}
zoffset {{frame+3*seed+(irregularity/2)}}
octaves 2
gamma 1
xrotate {{irregularity*45}}
yrotate {{irregularity*45}}
name blue
xpos 252
ypos 20
}
Transform {
scale {{parent.aspect_ratio>1?parent.aspect_ratio:1 x3 0} {parent.aspect_ratio<1?1/parent.aspect_ratio:1 x3 0}}
filter {{parent.ar_filter}}
shutteroffset centred
name Scale_Ratio
xpos 252
ypos 62
}
Blur {
channels {rgba.red -rgba.green -rgba.blue none}
size {{parent.red_soft}}
name Blur1
label "size \[value size]"
xpos 252
ypos 122
}
Blur {
channels {-rgba.red rgba.green -rgba.blue none}
size {{parent.green_soft}}
name Blur2
label "size \[value size]"
xpos 252
ypos 173
}
Blur {
channels {-rgba.red -rgba.green rgba.blue none}
size {{parent.blue_soft}}
name Blur3
label "size \[value size]"
xpos 252
ypos 223
}
Grade {
multiply 2
add -1
black_clamp false
name Grade1
xpos 252
ypos 295
}
push $N36691400
Grade {
black {{parent.red_i} {parent.green_i} {parent.blue_i} {curve}}
white {{parent.red_m} {parent.green_m} {parent.blue_m} {curve}}
name Grade4
xpos 130
ypos 422
}
Merge2 {
inputs 2
operation multiply
bbox B
name Merge3
xpos 252
ypos 422
}
Saturation {
saturation {{parent.saturation}}
name Saturation1
xpos 252
ypos 465
}
Dot {
name Dot3
tile_color 0x7aa9ff00
xpos 286
ypos 557
}
push $N36692c00
Merge2 {
inputs 2+1
operation plus
bbox B
output rgb
invert_mask {{invert_alpha}}
mix {{parent.mix}}
name Merge4
xpos 34
ypos 553
}
Keymix {
inputs 3
invertMask {{!invert_mask}}
name Keymix1
xpos 34
ypos 669
disable {{"!\[exists parent.input1] "}}
}
Output {
name Output1
xpos 34
ypos 758
}
end_group
Colorspace {
colorspace_out YCbCr
name Colorspace1
xpos -244
ypos 265
}
set N36625000 [stack 0]
Dot {
name Dot2
xpos -44
ypos 268
}
set N36624c00 [stack 0]
Dot {
name Dot1
xpos 171
ypos 268
}
Transform {
translate {4 0}
center {2456 1632}
black_outside false
name TransformCr
label "Transform Chroma Red"
xpos 137
ypos 406
}
Transform {
translate {{parent.ChromaWeaveX.expResult} {parent.ChromaWeaveY.expResult}}
center {1024 778}
black_outside false
name Transform4
label "Chroma Weave"
xpos 137
ypos 493
}
Dot {
name Dot7
xpos 171
ypos 636
}
push $N36624c00
Transform {
translate {4 0}
center {2456 1632}
black_outside false
name TransformCb
label "Transform Chroma Blue"
xpos -78
ypos 405
}
Transform {
translate {{parent.ChromaWeaveX.expResult} {parent.ChromaWeaveY.expResult}}
center {1024 778}
black_outside false
name Transform3
label "Chroma Weave"
xpos -78
ypos 493
}
Dot {
name Dot8
xpos -44
ypos 585
}
push $N36625000
Remove {
name Remove2
xpos -635
ypos 259
}
Grid {
number {0 {parent.deck_interlaceerror_bars}}
size 52
translate {0 {"parent.deck_interlaceerror_direction == 0? (frame * parent.deck_interlaceerror_speed) : (1 - (frame * parent.deck_interlaceerror_speed))"}}
name InterlaceErrorGrid
selected true
xpos -635
ypos 370
}
Blur {
size 18.5
name InterlaceErrorBlur
xpos -635
ypos 417
}
push $N36625000
Merge2 {
inputs 2
operation multiply
mix 0.1
name InterlaceErrorMerge
xpos -244
ypos 423
}
Copy {
inputs 2
from0 rgba.green
to0 rgba.green
from1 -rgba.blue
to1 -rgba.blue
name Copy1
xpos -244
ypos 576
}
Copy {
inputs 2
from0 rgba.blue
to0 rgba.blue
name Copy2
xpos -244
ypos 627
}
Reformat {
type scale
format "4912 3264 0 0 4912 3264 1 "
resize none
name Reformat1
xpos -244
ypos 663
}
Blur {
channels {rgba.red -rgba.green -rgba.blue none}
size 1.5
name lumaBlur
xpos -244
ypos 708
}
Blur {
channels {-rgba.red rgba.green rgba.blue none}
size 5
name chromaBlur
label "Chroma Blur"
xpos -244
ypos 755
}
Colorspace {
colorspace_in YCbCr
name Colorspace2
xpos -244
ypos 791
}
Blur {
channels {rgba.red -rgba.green -rgba.blue none}
size 1.7
name BlurRed
xpos -244
ypos 1251
}
Blur {
channels {-rgba.red rgba.green -rgba.blue none}
size 0.65
name BlurGreen
xpos -244
ypos 1295
}
Blur {
channels {-rgba.red -rgba.green rgba.blue none}
size 1
name BlurBlue
xpos -244
ypos 1342
}
Dot {
name Dot9
xpos -210
ypos 1450
}
set N3791ec00 [stack 0]
Dot {
name Dot10
xpos -76
ypos 1450
}
set N3791e800 [stack 0]
Dot {
name Dot11
xpos 44
ypos 1450
}
set N3791e400 [stack 0]
Dot {
name Dot12
xpos 173
ypos 1450
}
Transform {
center {1024 778}
name Offset_Blue
xpos 139
ypos 1511
}
Dot {
name Dot15
xpos 173
ypos 1742
}
push $N3791e400
Transform {
translate {1 0}
center {1024 778}
name Offset_Green
xpos 10
ypos 1511
}
Dot {
name Dot14
xpos 44
ypos 1672
}
push $N3791e800
Transform {
center {1024 778}
name Offset_Red
xpos -110
ypos 1510
}
Dot {
name Dot13
xpos -76
ypos 1578
}
push $N3791ec00
Copy {
inputs 2
from0 rgba.red
to0 rgba.red
name Copy3
xpos -244
ypos 1569
}
Copy {
inputs 2
from0 rgba.green
to0 rgba.green
name Copy4
xpos -244
ypos 1663
}
Copy {
inputs 2
from0 rgba.blue
to0 rgba.blue
name Copy5
xpos -244
ypos 1733
}
Reformat {
type scale
format "4912 3264 0 0 4912 3264 1 "
resize none
name Reformat2
xpos -244
ypos 1814
}
set N378cb400 [stack 0]
Dot {
name Dot3
xpos -210
ypos 2088
}
set N378cac00 [stack 0]
OCIOLogConvert {
operation "lin to log"
name OCIOLogConvert4
xpos -244
ypos 2149
}
Sharpen {
size {{parent.deck_sharpen}}
name Sharpen2
label "Post sharpening (applied by VHS deck)"
xpos -244
ypos 2173
}
OCIOLogConvert {
operation "log to lin"
name OCIOLogConvert3
xpos -244
ypos 2223
}
push $N378cac00
Dot {
name Dot6
xpos -69
ypos 2088
}
Sharpen {
size {{parent.deck_sharpen}}
name Sharpen1
label "Post sharpening (applied by VHS deck)"
xpos -103
ypos 2174
}
Switch {
inputs 2
which {{parent.deck_logSharpen}}
name Switch1
label "Log Sharpen Switch"
xpos -173
ypos 2273
}
Shuffle2 {
fromInput1 {{0} B}
fromInput2 {{0} B}
mappings "4 rgba.red 0 0 rgba.red 0 0 rgba.green 0 1 rgba.green 0 1 rgba.blue 0 2 rgba.blue 0 2 white -1 -1 rgba.alpha 0 3"
name Shuffle1
xpos -173
ypos 2335
}
Dot {
name Dot5
xpos -139
ypos 2388
}
Output {
name Output1
xpos -173
ypos 2953
}
Noise {
inputs 0
cliptype none
replace true
size 75
zoffset {{frame}}
nyquist false
lacunarity 1.5
gain 1
gamma 0.925
translate {-483 14}
scale {10 1}
center {1024 576}
name Noise3
xpos -18
ypos 2439
hide_input true
}
Sharpen {
amount 3
name Sharpen3
xpos -18
ypos 2463
}
Constant {
inputs 0
channels rgb
name Constant1
xpos -81
ypos -244
}
push $N378cb400
Viewer {
frame_range 1-100
viewerProcess "sRGB (default)"
name Viewer1
xpos -16
ypos 2575
}
Group {
inputs 0
name ChromaWeaveX
help "Allows the easy creation of a variety of Waveform Expressions for use in manipulating knob values."
xpos 26
ypos 446
addUserKnob {20 main l Main}
addUserKnob {26 unnamed_1 l "" +STARTLINE T " "}
addUserKnob {68 type l "Wave Type" t "Controls what type of wave to generate." M {Random Noise Sine Triangle Square Sawtooth/Sawtooth "Sawtooth/Sawtooth (Parabolic)" "Sawtooth/Sawtooth (Parabolic reversed)" "Sawtooth/Sawtooth (Exponential)" Bounce "" "" "" "" ""}}
type Sine
addUserKnob {7 minVal l "Min Value" t "Minimum value you want the wave to reach." R -10 0}
minVal -0.5
addUserKnob {7 maxVal l "Max Value" t "Maximum value you want the wave to reach." -STARTLINE R 0 10}
maxVal 0.5
addUserKnob {7 waveLength l WaveLength t "Controls the frequency or cycle length of the wave. The number of frames before the pattern repeats." R 0 100}
waveLength 24
addUserKnob {7 offset l Offset t "Offsets the frame value to allow control of values at a certain frame" R 0 10}
addUserKnob {26 unnamed l "" +STARTLINE T " "}
addUserKnob {22 expButton l "Generate Expression" T "node = nuke.thisNode()\ntype = node.knob('type').getValue()\nexpText = node.knob('expText')\nexpFormula = node.knob('formula')\nexpResult = node.knob('expResult')\ndef setExp():\n if type == 0: #Random\n exp = 'random((frame+%s)/%s) * (%s-%s) + %s' %(offset,waveLength,maxVal,minVal,minVal)\n if type == 1: #Noise\n exp = '(noise((frame+%s)/%s)+1)/2 * (%s-%s) + %s' %(offset,waveLength,maxVal,minVal,minVal)\n if type == 2: #Sine\n exp = '(sin(2*pi*(frame+%s)/%s)+1)/2 * (%s-%s) + %s' %(offset,waveLength,maxVal,minVal,minVal)\n if type == 3: #Triangle\n exp = '(asin(sin(2*pi*(frame+%s)/%s))/pi+0.5) * (%s-%s) + %s' %(offset,waveLength,maxVal,minVal,minVal)\n if type == 4: #Square\n exp = 'int(sin(2*pi*(frame+%s)/%s)+1) * (%s-%s) + %s' %(offset,waveLength,maxVal,minVal,minVal)\n if type == 5: #Sawtooth\n exp = '((frame+%s) %% %s)/%s * (%s-%s) + %s' %(offset,waveLength,waveLength,maxVal,minVal,minVal)\n if type == 6: #Sawtooth(Parabolic)\n exp = 'sin((4.93480220054468*(frame+%s)/(pi*%s)) %% (pi/2)) * (%s-%s) + %s' %(offset,waveLength,maxVal,minVal,minVal)\n if type == 7: #Sawtooth(Parabolic Reversed)\n exp = 'cos((4.93480220054468*(frame+%s)/(pi*%s)) %% (pi/2)) * (%s-%s) + %s' %(offset,waveLength,maxVal,minVal,minVal)\n if type == 8: #Sawtooth (Exponential)\n exp = '(exp(2*pi*((frame+%s) %% %s)/%s)-1)/exp(2*pi) * (%s-%s) + %s' %(offset,waveLength,waveLength,maxVal,minVal,minVal)\n if type == 9: #Bounce\n exp = 'abs(sin(pi*(frame + %s)/%s))* (%s-%s) + %s' %(offset,waveLength,maxVal,minVal,minVal)\n return exp\n\nwaveLength = 'waveLength'\noffset = 'offset'\nmaxVal = 'maxVal'\nminVal = 'minVal'\nexpResult.setExpression(setExp())\nexpFormula.setValue(setExp())\n\nwaveLength = node.knob('waveLength').getValue()\noffset = node.knob('offset').getValue()\nmaxVal = node.knob('maxVal').getValue()\nminVal = node.knob('minVal').getValue()\nexpText.setValue(setExp())" +STARTLINE}
addUserKnob {26 ""}
addUserKnob {7 expResult l Result t "The calculated result of the wave at the given frame. Link to this value if you want to control the expression from this node."}
expResult {{"(sin(2*pi*(frame+offset)/waveLength)+1)/2 * (maxVal-minVal) + minVal"}}
addUserKnob {26 unnamed_2 l "" +STARTLINE T " "}
addUserKnob {1 expText l Expression t "The wave in expression form. For copying to another knobs expression value."}
expText "(sin(2*pi*(frame+0.0)/100.0)+1)/2 * (2.0--2.0) + -2.0"
addUserKnob {26 unnamed_3 l "" +STARTLINE T " "}
addUserKnob {1 formula l Formula t "The formula that generates the wave."}
formula "(sin(2*pi*(frame+offset)/waveLength)+1)/2 * (maxVal-minVal) + minVal"
}
end_group
end_group
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment