I created this small guide because during my period of work at Trixter, I've learnt how powerful could be the Expression Node. So I tried to collect as much tools as possible. In the Link below you can find all the website that I've found info and codes. I also would like to say thank you to the comp team of Trixter for the incredible workshops about the Expressions.
HOW TO INSTALL IT?
It's really easy to install the package, because all the paths and folders are already created.
1. Extract the folder from the file .zip
2. Drag and drop the folder in your .nuke folder
#path would be something like this:
#Linux: /home/login name/.nuke
#Mac OS X: /Users/login name/.nuke
#Windows: C:\Users\user name\.nuke
3. Add this code to your file init.py
Expression_path = "/Users/yourPath/.nuke/Expression"
nuke.pluginAddPath(Expression_path)
4. Run Nuke
Overview
You will find some text called
Show/Hide node script
Click on it to show/hide the text of the relative node. Copy and Paste it in the Node Graph of Nuke! If you want all the collection, please, download it from Nukepedia at the link above
Click on the links below to go directly to the section you want:
In this first category you can create different elements only with the Expression Node. Here you will find some of the tool in the Collection.
RANDOM
Create random colors every pixel/every frame
Show/Hide node script
set cut_paste_input [stack 0]
version 10.5 v2
push $cut_paste_input
Expression {
expr0 random
expr1 random
expr2 random
expr3 random
name Random_every_pixel
selected true
xpos 1125
ypos 232
}
Expression {
inputs 0
expr0 random(frame)*random
expr1 random(frame)*random
expr2 random(frame)*random
expr3 random(frame)*random
name Random_every_frame
selected true
xpos 1123
ypos 189
}
LINES
Create horizontal/vertical lines with different width and smoothness.
CIRCLES
RADIAL
POINTS
Create points with different color and opacity. Combined with a Convolve Node and a Shape you can create different types of walls.
Show/Hide node script
set cut_paste_input [stack 0]
version 10.5 v2
push $cut_paste_input
Expression {
expr0 fmod(x,offsetX)==0?fmod(y,offsetY)==0?random_colors?random:value:0:0
expr1 fmod(x,offsetX)==0?fmod(y,offsetY)==0?random_colors?random:value:0:0
expr2 fmod(x,offsetX)==0?fmod(y,offsetY)==0?random_colors?random:value:0:0
expr3 fmod(x,offsetX)==0?fmod(y,offsetY)==0?random_colors?1:value:0:0
name Points
selected true
xpos 396
ypos -174
addUserKnob {20 User}
addUserKnob {7 value}
value 1
addUserKnob {6 random_colors l "random colors" -STARTLINE}
random_colors true
addUserKnob {7 offsetX R 0 100}
offsetX 200
addUserKnob {7 offsetY R 0 100}
offsetY 200
}
BRICKS
Wall of bricks that you can create combining Expression and UV Map Nodes
Show/Hide node script
set cut_paste_input [stack 0]
version 10.5 v2
push $cut_paste_input
Expression {
temp_name0 dimension_width
temp_expr0 size*width_brick
temp_name1 difference_size
temp_expr1 size
temp_name2 dimension_height
temp_expr2 size
expr0 "floor(y/size)%2 == 0? (x%(dimension_width*scale))/(difference_size*width_brick*scale) : ((x+offset)%dimension_width)/(difference_size*width_brick)"
expr1 "floor(y/size)%2 == 0? (y%dimension_height)/(difference_size) : ((y)%dimension_height)/(difference_size)"
name bricks
selected true
xpos 131
ypos -105
addUserKnob {20 User}
addUserKnob {7 size R 0 200}
size 216
addUserKnob {7 offset R 0 100}
offset 132
addUserKnob {7 scale R 0 6}
scale 1
addUserKnob {26 ""}
addUserKnob {7 width_brick R 0 5}
width_brick 1.3
addUserKnob {3 random_value l INVISIBLE +INVISIBLE}
random_value 61
}
TRUNC
Round to the nearest integer not larger in absolute value
Some of the operations you can do with the Alpha channel:
In this third section, Pixel, we are going to work with Pixels. This part is really good for Tech Checks of your shots.
ABSOLUTE VALUE
Returns the absolute value of the floating-point number x
Show/Hide node script
set cut_paste_input [stack 0]
version 10.5 v2
BackdropNode {
inputs 0
name BackdropNode3
tile_color 0x7171c600
label ABS
note_font_size 42
selected true
xpos -311
ypos -252
bdwidth 274
bdheight 394
}
StickyNote {
inputs 0
name StickyNote1
label "Return the Absolute value (always positive values)"
selected true
xpos -290
ypos 98
}
Constant {
inputs 0
color 1
name Constant2
selected true
xpos -218
ypos -143
}
Multiply {
channels rgba
value -1
name Multiply1
label -1
selected true
xpos -218
ypos -30
}
Expression {
expr0 abs(r)
expr1 abs(g)
expr2 abs(b)
expr3 abs(a)
name ABS
selected true
xpos -218
ypos 47
}
INF NAN NEGATIVE PIXELS
Find the infinite, NaN and Negative Pixels in your image.
Show/Hide node script
set cut_paste_input [stack 0]
version 10.5 v2
BackdropNode {
inputs 0
name BackdropNode17
tile_color 0x7190c6ff
label check
note_font_size 42
selected true
xpos 347
ypos -340
bdwidth 279
bdheight 237
z_order 1
}
push $cut_paste_input
Dot {
name Dot1
selected true
xpos 478
ypos -269
}
set N1e6e4590 [stack 0]
Expression {
expr0 isinf(r)?1000:0
expr1 isinf(g)?1000:0
expr2 isinf(b)?1000:0
expr3 isinf(a)?1000:0
name Expression17
label INF
selected true
xpos 357
ypos -210
}
Blur {
channels rgba
size 20
name Blur204
label "\[value size]"
selected true
xpos 357
ypos -172
}
push $N1e6e4590
Expression {
expr0 isnan(r)?1000:0
expr1 isnan(g)?1000:0
expr2 isnan(b)?1000:0
expr3 isnan(a)?1000:0
name Expression16
label NAN
selected true
xpos 504
ypos -215
}
Blur {
channels rgba
size 20
name Blur205
label "\[value size]"
selected true
xpos 504
ypos -169
}
Some useful tools for the Keying and Despill operations.
BLUE DESPILL
Different despill techniques for blue screen.
Show/Hide node script
set cut_paste_input [stack 0]
version 10.5 v2
ColorWheel {
inputs 0
gamma 0.45
name ColorWheel3
selected true
xpos 1466
ypos -179
}
Dot {
name Dot3
selected true
xpos 1500
ypos -66
}
set N2eb56c50 [stack 0]
Expression {
expr2 b>(g+2*r)/2*LimitPercentage?(g+2*r)/2*LimitPercentage:b
expr3 b-(2*r+g)*LimitPercentage/2
name DoubleRedAve2
tile_color 0xff01
selected true
xpos 1688
ypos 63
addUserKnob {20 User}
addUserKnob {7 LimitPercentage l "fine tune" R 0.5 1.5}
LimitPercentage 1
}
push $N2eb56c50
Expression {
expr2 b>(g+r)/2*LimitPercentage?(g+r)/2*LimitPercentage:b
expr3 b-(r+g)*LimitPercentage/2
name Average
tile_color 0xff01
selected true
xpos 1576
ypos 64
addUserKnob {20 User}
addUserKnob {7 LimitPercentage l "fine tune" R 0.5 1.5}
LimitPercentage 1
}
push $N2eb56c50
Expression {
expr2 b>(2*g+r)/2*LimitPercentage?(2*g+r)/2*LimitPercentage:b
expr3 b-(r+2*g)*LimitPercentage/2
name DoubleGreenAve
tile_color 0xff01
selected true
xpos 1466
ypos 63
addUserKnob {20 User}
addUserKnob {7 LimitPercentage l "fine tune" R 0.5 1.5}
LimitPercentage 1
}
push $N2eb56c50
Expression {
expr2 b>g*LimitPercentage?g*LimitPercentage:b
expr3 b-g*LimitPercentage
name GreenLimitsBlue
tile_color 0xff01
selected true
xpos 1354
ypos 63
addUserKnob {20 User}
addUserKnob {7 LimitPercentage l "fine tune" R 0.5 1.5}
LimitPercentage 1
}
push $N2eb56c50
Expression {
expr2 b>r*LimitPercentage?r*LimitPercentage:b
expr3 b-r*LimitPercentage
name RedLimitsBlue
tile_color 0xff01
selected true
xpos 1246
ypos 63
addUserKnob {20 User}
addUserKnob {7 LimitPercentage l "fine tune" R 0.5 1.5}
LimitPercentage 1
}
GREEN DESPILL
Different despill techniques for green screen.
Show/Hide node script
set cut_paste_input [stack 0]
version 10.5 v2
ColorWheel {
inputs 0
gamma 0.45
name ColorWheel2
selected true
xpos 869
ypos -127
}
Dot {
name Dot2
selected true
xpos 903
ypos -11
}
set N2eb50ba0 [stack 0]
Expression {
expr1 g>(b+2*r)/3*LimitPercentage?(b+2*r)/3*LimitPercentage:g
expr3 g-(r+b)*LimitPercentage/2
name DoubleRedAve
tile_color 0xff0001
selected true
xpos 1091
ypos 143
addUserKnob {20 User}
addUserKnob {7 LimitPercentage l "fine tune" R 0.5 1.5}
LimitPercentage 1
}
push $N2eb50ba0
Expression {
expr1 g>(2*b+r)/3*LimitPercentage?(2*b+r)/3*LimitPercentage:g
expr3 g-(r+b)*LimitPercentage/2
name DoubleBlueAve
tile_color 0xff0001
selected true
xpos 979
ypos 143
addUserKnob {20 User}
addUserKnob {7 LimitPercentage l "fine tune" R 0.5 1.5}
LimitPercentage 1
}
push $N2eb50ba0
Expression {
expr1 g>(b+r)/2*LimitPercentage?(b+r)/2*LimitPercentage:g
expr3 g-(r+b)*LimitPercentage/2
name AverageGreen
tile_color 0xff0001
selected true
xpos 869
ypos 143
addUserKnob {20 User}
addUserKnob {7 LimitPercentage l "fine tune" R 0.5 1.5}
LimitPercentage 1
}
push $N2eb50ba0
Expression {
expr1 g>b*LimitPercentage?b*LimitPercentage:g
expr3 g-b*LimitPercentage
name BlueLimitsGreen
tile_color 0xff0001
selected true
xpos 759
ypos 143
addUserKnob {20 User}
addUserKnob {7 LimitPercentage l "fine tune" R 0.5 1.5}
LimitPercentage 1
}
push $N2eb50ba0
Expression {
expr1 g>r*LimitPercentage?r*LimitPercentage:g
expr3 g-r*LimitPercentage
name RedLimitsGreen
tile_color 0xff0001
selected true
xpos 650
ypos 143
addUserKnob {20 User}
addUserKnob {7 LimitPercentage l "fine tune" R 0.5 1.5}
LimitPercentage 1
}
Tools you can use to transform and manipulate your image.
Some useful tools for 3D space and Deep Compositing.
NORMAL PASS - RELIGHT
Use the Normal Pass to create in the alpha channel a new light.
Show/Hide node script
set cut_paste_input [stack 0]
version 10.5 v2
push $cut_paste_input
add_layer {normal normal.red normal.green normal.blue normal.alpha}
Shuffle {
in normal
name Shuffle2
label "\[value in]"
selected true
xpos 1370
ypos 205
}
Expression {
expr3 max((r*norm.r)+(g*norm.g)+(b*norm.b),0)
name Expression1
label RELIGHT
selected true
xpos 1370
ypos 259
addUserKnob {20 User}
addUserKnob {7 round l left/right R -100 100}
round 1
addUserKnob {7 around l up/down R -100 100}
around 1
addUserKnob {26 ""}
addUserKnob {7 rad}
rad {{cos(radians(around))}}
addUserKnob {7 lx}
lx {{rad*cos(radians(round))}}
addUserKnob {7 ly}
ly {{sin(radians(around))}}
addUserKnob {7 lz}
lz {{rad*sin(radians(round))}}
addUserKnob {18 norm}
norm {{lx/sqrt(pow2(lx)+pow2(ly)+pow2(lz))} {ly/sqrt(pow2(lx)+pow2(ly)+pow2(lz))} {lz/sqrt(pow2(lx)+pow2(ly)+pow2(lz))}}
addUserKnob {6 norm_panelDropped l "panel dropped state" -STARTLINE +HIDDEN}
}
COORDINATES
Create a map of coordinates .
C4x4
Matrix 4x4 to project the object in the 3D space and apply a distortion .
UV Map
Show/Hide node script
set cut_paste_input [stack 0]
version 10.5 v2
push $cut_paste_input
Group {
name UV_Map
help "Create an uvmap from the input format or the selected format that can be used for example for baking transformations and applying them through a STmap node.\nUse the overscan to create values outside of the viewing window and the 0-1 range."
note_font "Bitstream Vera Sans"
selected true
xpos 1062
ypos 295
mapsize {0.15 0.15}
addUserKnob {20 tab l "UV Map"}
addUserKnob {41 format T Constant1.format}
addUserKnob {41 scale l overscan T Reformat1.scale}
addUserKnob {6 alpha l "alpha 1" +STARTLINE}
}
Input {
inputs 0
name Input1
xpos 620
ypos -370
}
Shuffle {
red black
green black
blue black
alpha black
name Shuffle1
xpos 620
ypos -309
}
Constant {
inputs 0
name Constant1
xpos 479
ypos -214
}
Switch {
inputs 2
which {{"\[exists parent.input0]"}}
name Switch1
xpos 620
ypos -191
}
Reformat {
type scale
black_outside true
pbb true
name Reformat1
xpos 620
ypos -71
}
Reformat {
type scale
scale {{1/Reformat1.scale} {1/Reformat1.scale}}
resize none
black_outside true
pbb true
name Reformat2
xpos 620
ypos -37
}
Shuffle {
alpha white
name Shuffle13
tile_color 0xffffff00
label "\[value in]"
xpos 620
ypos 12
disable {{!parent.alpha}}
}
Expression {
expr0 (x+0.5)/width
expr1 (y+0.5)/height
name Expression2
xpos 620
ypos 75
}
Output {
name Output1
xpos 620
ypos 127
}
end_group
Deep to Depth
Convert the Deep into Depth
Show/Hide node script
set cut_paste_input [stack 0]
version 10.5 v2
push $cut_paste_input
DeepToImage {
name DeepToImage1
selected true
xpos 785
ypos 230
}
AddChannels {
channels depth
name AddChannels1
selected true
xpos 785
ypos 277
}
Expression {
channel3 depth
expr3 "deep.r == 0 ? inf : deep.r"
name DeepToDepth
selected true
xpos 785
ypos 336
}
Deep Thickness
Create the smoothness of front and back layer. It's really good to smooth the elements through a deep smoke.
Show/Hide node script
set cut_paste_input [stack 0]
version 10.5 v2
push $cut_paste_input
DeepExpression {
temp_name3 t
temp_expr3 "\[value tickness]/2"
chans1 deep
deep.front deep.front-t
deep.back deep.back+t
name DeepThickness
selected true
xpos 918
ypos 244
addUserKnob {20 Thickness}
addUserKnob {7 thickness R 0 100}
}