Skip to content

Instantly share code, notes, and snippets.

View greenvfx's full-sized avatar

Vitalii Musatov greenvfx

  • Industrial Light & Magic
  • Vancouver
  • LinkedIn in/vmusatov
View GitHub Profile
@greenvfx
greenvfx / Transform.cpp
Created March 20, 2023 02:23 — forked from jedypod/Transform.cpp
Nuke blinkscript implementation of a simple image Transform operator. This blinkscript demonstrates pixel filter interpolation algorithms.
/*
Nuke blinkscript implementation of a simple image Transform operator.
Demonstrates pixel filter interpolation algorithms.
The following pixel filters are implemented:
0 - Blackman-Harris : Similar to cubic, but better performance in high frequencies
1 - Lanczos4 : 2x2 lanczos windowed sinc function
2 - Lanczos6 : 3x3 lanczos windowed sinc function
3 - Cubic : (Bicubic interpolation) - a=0.0, b=0.0
4 - Mitchell : (Bicubic interpolation) - a=1/3, b=1/3
@greenvfx
greenvfx / blending_mode_switcher.py
Last active December 15, 2022 04:48
switch blending modes in Roto and RotoPaint nodes in Nuke
def blending_mode_switcher():
MODES = ['color-burn', 'color-dodge', 'difference', 'exclusion', 'from', 'hard-light', 'max', 'min', 'minus', 'multiply', 'over', 'overlay', 'plus', 'screen', 'soft-light'] # OR ['max', 'over']
SUPPORTED_NODES = ['Roto', "RotoPaint"]
nodes = nuke.allNodes(recurseGroups = True)
active_nodes = [node for node in nodes if (node.shown() and node.Class() in SUPPORTED_NODES)]
for found in active_nodes:
try:
current_mode = found['toolbar_blending_mode'].value()
except:
set cut_paste_input [stack 0]
version 12.2 v4
push $cut_paste_input
Text2 {
font_size_toolbar 100
font_width_toolbar 100
font_height_toolbar 100
message "\[join \[lrange \[split \[file dirname \[value root.name] ] /] 0 2 ] / ]/render/\[join \[lrange \[split \[file tail \[value root.name] ] _ ] 0 1 ] _ ].%07d.dpx\n\n\[join \[lrange \[split \[file tail \[value root.name] ] _ ] 0 1 ] _ ].%07d.dpx"
old_message {{68 58 47 100 101 118 47 115 99 114 105 112 116 45 48 49 53 48 47 114 101 110 100 101 114 47 115 99 114 105 112 116 45 48 49 53 48 95 99 111 109 112 46 37 48 55 100 46 100 112 120 10 10 115 99 114 105 112 116 45 48 49 53 48 95 99 111 109 112 46 37 48 55 100 46 100 112 120}
}
@greenvfx
greenvfx / CounterText_v001.nk
Created March 22, 2022 18:23
a simple python based counter for Nuke
set cut_paste_input [stack 0]
version 12.2 v4
push $cut_paste_input
Text2 {
font_size_toolbar 100
font_width_toolbar 100
font_height_toolbar 100
message "\[python \{str(int(nuke.thisNode()\['counter'].value())).zfill(int(nuke.thisNode()\['padding'].value()))\}]"
old_message {{48 49 49}
}
@greenvfx
greenvfx / blocky_noise.nk
Created December 27, 2021 04:26
blocky noise test
set cut_paste_input [stack 0]
version 12.2 v4
push $cut_paste_input
Noise {
type turbulence
zoffset {{frame/10}}
octaves 24
nyquist false
lacunarity 1
gain 0.162
@greenvfx
greenvfx / deep_example.nk
Last active December 21, 2021 05:30
Nuke's deep example
#! C:/Program Files/Nuke12.2v4/nuke-12.2.4.dll -nx
version 12.2 v4
define_window_layout_xml {<?xml version="1.0" encoding="UTF-8"?>
<layout version="1.0">
<window x="68" y="0" w="1849" h="1048" screen="0">
<splitter orientation="1">
<split size="40"/>
<dock id="" hideTitles="1" activePageId="Toolbar.1">
<page id="Toolbar.1"/>
</dock>
@greenvfx
greenvfx / menu.py
Created December 25, 2020 16:29 — forked from dbr/menu.py
Alternative viewer connection shorcuts - alt+1..9 connect viewer, 1..9 only switch viewer
def viewer_shotcuts_alt():
# Alt+1, Alt+2 etc to connect node to viewer
for n in range(9):
def connect_viewer(n=n):
selection = nuke.selectedNodes()
nuke.connectViewer(n, nuke.selectedNode())
[node.setSelected(False) for node in nuke.selectedNodes()]
[node.setSelected(True) for node in selection]
nuke.menu("Node Graph").addMenu("ViewerThing").addCommand(
@greenvfx
greenvfx / PlanarProjection.nk
Created December 25, 2020 16:25 — forked from jedypod/PlanarProjection.nk
PlanarProjection Planar Projection Generates 2D coordinates for points in 3D space. Works on 4 points at once, is instantaneous to calculate, and generates a 4x4 transform matrix for use in rotos.
set cut_paste_input [stack 0]
push $cut_paste_input
Group {
name PlanarProjection
help "<b>Planar Projection</b>\nGenerates 2D coordinates for points in 3D space. Type in 3D point coordinates, or use vertex selection in 3D viewer and click set to pick average of selected points, or set points to set all four points at once. \n\nYou can connect node output to scene together with your pointcloud or geometry and see where your points are located in 3d space. Double click any of them to move it in 3d space like any traditional nuke transform control. \n\nA matrix transform is also generated to be used with RotoPaint, SplineWarp and GridWarp nodes. If you are using matrix in GridWarp, points have to be in clockwise order, pick them one by one! \n\nCommand set points doesn't respect selection order! \n\nCheck out the demo video on my website! Kudos to Ivan Busquets for help with matrix math. \n\n-- developed by Vit Sedlacek 2012 www.vitsedlacek.com \n\n-- Modified by Jed Smith to make calculation time nearly inst
#! C:/Program Files/Nuke12.0v3/nuke-12.0.3.dll -nx
version 12.0 v3
define_window_layout_xml {<?xml version="1.0" encoding="UTF-8"?>
<layout version="1.0">
<window x="81" y="0" w="1836" h="1044" screen="0">
<splitter orientation="1">
<split size="43"/>
<dock id="" hideTitles="1" activePageId="Toolbar.1">
<page id="Toolbar.1"/>
</dock>
test_v[ format %0[value CTRL.padding]d [value CTRL.ver] ].jpg