Skip to content

Instantly share code, notes, and snippets.

@kpprt
Last active April 5, 2018 13:15
Show Gist options
  • Save kpprt/14fa65f4479ea04d3613429009d776a9 to your computer and use it in GitHub Desktop.
Save kpprt/14fa65f4479ea04d3613429009d776a9 to your computer and use it in GitHub Desktop.
Creates a Chromatic Aberration in Nuke. It utilizes the LensDistortion node to scale the color channels stronger around the edges. There is also an option to blur the distortion for each channel.
set cut_paste_input [stack 0]
version 10.5 v3
push $cut_paste_input
Group {
name CS_ChromaticAberration1
tile_color 0xcc804eff
addUserKnob {20 CS_ChromaticAberration}
addUserKnob {20 Red_Cyan l Red/Cyan n 1}
addUserKnob {41 distortion1_red l "Radial Distortion 1" T LensDistortionRed.distortion1}
addUserKnob {41 distortion2_red l "Radial Distortion 2" T LensDistortionRed.distortion2}
addUserKnob {41 distortionCenter_red l "Distortion Center" T LensDistortionRed.distortionCenter}
addUserKnob {41 scale_red l blur T VectorBlur2_1.scale}
addUserKnob {41 mix_red l mix T CopyRed.mix}
addUserKnob {20 endGroup_red l endGroup n -1}
addUserKnob {20 Green_Magenta l Green/Magenta n 1}
addUserKnob {41 distortion1_green l "Radial Distortion 1" T LensDistortionGreen.distortion1}
addUserKnob {41 distortion2_green l "Radial Distortion 2" T LensDistortionGreen.distortion2}
addUserKnob {41 distortionCenter_green l "Distortion Center" T LensDistortionGreen.distortionCenter}
addUserKnob {41 scale_green l blur T VectorBlur2_2.scale}
addUserKnob {41 mix_green l mix T CopyGreen.mix}
addUserKnob {20 endGroup_green l endGroup n -1}
addUserKnob {20 Blue_Yellow l Blue/Yellow n 1}
addUserKnob {41 distortion1_blue l "Radial Distortion 1" T LensDistortionBlue.distortion1}
addUserKnob {41 distortion2_blue l "Radial Distortion 2" T LensDistortionBlue.distortion2}
addUserKnob {41 distortionCenter_blue l "Distortion Center" T LensDistortionBlue.distortionCenter}
addUserKnob {41 scale_blue l blur T VectorBlur2_3.scale}
addUserKnob {41 mix_blue l mix T CopyBlue.mix}
addUserKnob {20 endGroup_blue l endGroup n -1}
addUserKnob {26 ""}
addUserKnob {26 Creator l "" +STARTLINE T "CS_ChromaticAberration v1.2 by Christian Schulze - www.christian-schulze.eu"}
}
Input {
inputs 0
name Input
xpos -40
ypos -274
}
Dot {
name Dot13
xpos -6
ypos -198
}
set N6cb6400 [stack 0]
Expression {
channel0 {forward.u -forward.v}
expr0 x
channel1 {-forward.u forward.v}
expr1 y
channel2 none
name Expression1
xpos -150
ypos -202
}
Dot {
name Dot18
xpos -226
ypos -198
}
set N6cb7800 [stack 0]
Dot {
name Dot5
xpos -336
ypos -198
}
set N6cb7400 [stack 0]
Dot {
name Dot12
xpos -556
ypos -198
}
set N6cf1800 [stack 0]
Dot {
name Dot3
xpos -666
ypos -198
}
set N6cf1400 [stack 0]
Dot {
name Dot8
xpos -886
ypos -198
}
set N6cf1000 [stack 0]
Dot {
name Dot2
xpos -996
ypos -198
}
Dot {
name Dot7
xpos -996
ypos -54
}
push $N6cf1000
LensDistortion1_0 {
serializeKnob ""
serialiseKnob "22 serialization::archive 9 0 0 0 0 0 0 0 0 0 0 0 0"
distortion1 0.01
cardScale {1.010204911 1.010204911 1}
a -0.001685338444
b -0.006407799199
c -0.002735857619
name LensDistortionRed
xpos -920
ypos -130
}
Merge2 {
inputs 2
operation minus
Achannels forward
Bchannels forward
output forward
name Merge1
xpos -920
ypos -64
}
VectorBlur2 {
channels rgba
uv forward
scale 1
name VectorBlur2_1
xpos -920
ypos 8
}
Dot {
name Dot6
xpos -886
ypos 186
}
push $N6cf1400
Dot {
name Dot11
xpos -666
ypos -54
}
push $N6cf1800
LensDistortion1_0 {
serializeKnob ""
serialiseKnob "22 serialization::archive 9 0 0 0 0 0 0 0 0 0 0 0 0"
name LensDistortionGreen
xpos -590
ypos -130
}
Merge2 {
inputs 2
operation minus
Achannels forward
Bchannels forward
output forward
name Merge2
xpos -590
ypos -64
}
VectorBlur2 {
channels rgba
uv forward
name VectorBlur2_2
xpos -590
ypos 8
}
Dot {
name Dot1
xpos -556
ypos 138
}
push $N6cb7400
Dot {
name Dot16
xpos -336
ypos -54
}
push $N6cb7800
LensDistortion1_0 {
serializeKnob ""
serialiseKnob "22 serialization::archive 9 0 0 0 0 0 0 0 0 0 0 0 0"
asymmetricDistortion {-0.005 0}
name LensDistortionBlue
xpos -260
ypos -130
}
Merge2 {
inputs 2
operation minus
Achannels forward
Bchannels forward
output forward
name Merge3
xpos -260
ypos -64
}
VectorBlur2 {
channels rgba
uv forward
name VectorBlur2_3
xpos -260
ypos 8
}
Dot {
name Dot4
xpos -226
ypos 90
}
push $N6cb6400
Copy {
inputs 2
from0 rgba.blue
to0 rgba.blue
name CopyBlue
xpos -40
ypos 80
}
Copy {
inputs 2
from0 rgba.green
to0 rgba.green
name CopyGreen
xpos -40
ypos 128
}
Copy {
inputs 2
from0 rgba.red
to0 rgba.red
name CopyRed
xpos -40
ypos 176
}
Output {
name Output
xpos -40
ypos 278
}
end_group
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment