I’ve made a 3×3 Matrix filter for the GPU! Yay!
There’s two hidden nodes in Nuke, GpuOp and GpuFileShader, both are nodes that can run GLSL shaders realtime in the Nuke viewers.
I had a quick look at it eariler this year, one of the things that came out of it was a 3×3 matrix filter. Pretty much identical to the built in matrix in Nuke. But realtime on the gpu. While this nodes is pretty awesome for prototyping effects and creating interesting LUTs, it has all the limitations of any GPU shader. Some of them are :
- Does not render
- Only affects whats in the viewer (ie, results zoom dependent)
- Memory limitations
But it does have some benefits like
- Runtime dev environment
- GpuOp node concatinates , can create complex effects
- Shader code is portable
How to use it
Turn of any viewing lut and enable “use gpu whenever possible” in the prefs, download the shader and point the nuke GpuMatrix node to the text-file. As always, if you end up using the GpuMatrix in any form, you’re in beer-debt to me.
-theo
Nuke node below and click here to download the shader.
set cut_paste_input [stack 0]
version 6.1 v1
push $cut_paste_input
GPUFileShader {
shader_file "/net/homes/tgroeneb/Desktop/RND - theo projects/gpuMatrix.txt"
name GpuMatrix2
selected true
xpos -4664
ypos 2406
addUserKnob {20 User}
addUserKnob {26 Presets}
addUserKnob {22 Reset -STARTLINE T "this =nuke.toNode('this')\nthis\['v1'].setValue(0)\nthis\['v2'].setValue(0)\nthis\['v3'].setValue(0)\n\nthis\['v4'].setValue(0)\nthis\['v5'].setValue(1)\nthis\['v6'].setValue(0)\n\nthis\['v7'].setValue(0)\nthis\['v8'].setValue(0)\nthis\['v9'].setValue(0)\n\nthis\['val'].setValue(1)"}
addUserKnob {22 Sharpen -STARTLINE T "this =nuke.toNode('this')\nthis\['v1'].setValue(0)\nthis\['v2'].setValue(-1)\nthis\['v3'].setValue(0)\n\nthis\['v4'].setValue(-1)\nthis\['v5'].setValue(5)\nthis\['v6'].setValue(-1)\n\nthis\['v7'].setValue(0)\nthis\['v8'].setValue(-1)\nthis\['v9'].setValue(0)"}
addUserKnob {22 Blur -STARTLINE T "this =nuke.toNode('this')\nthis\['v1'].setValue(1)\nthis\['v2'].setValue(1)\nthis\['v3'].setValue(1)\n\nthis\['v4'].setValue(1)\nthis\['v5'].setValue(1)\nthis\['v6'].setValue(1)\n\nthis\['v7'].setValue(1)\nthis\['v8'].setValue(1)\nthis\['v9'].setValue(1)\n\nthis\['norm'].setValue(1)"}
addUserKnob {22 EdgeDetect -STARTLINE T "this =nuke.toNode('this')\nthis\['v1'].setValue(0)\nthis\['v2'].setValue(1)\nthis\['v3'].setValue(0)\n\nthis\['v4'].setValue(1)\nthis\['v5'].setValue(-4)\nthis\['v6'].setValue(1)\n\nthis\['v7'].setValue(0)\nthis\['v8'].setValue(1)\nthis\['v9'].setValue(0)\n\nthis\['norm'].setValue(0)"}
addUserKnob {22 Emboss -STARTLINE T "this =nuke.toNode('this')\nthis\['v1'].setValue(-2)\nthis\['v2'].setValue(-1)\nthis\['v3'].setValue(0)\n\nthis\['v4'].setValue(-1)\nthis\['v5'].setValue(1)\nthis\['v6'].setValue(1)\n\nthis\['v7'].setValue(0)\nthis\['v8'].setValue(1)\nthis\['v9'].setValue(2)"}
addUserKnob {26 ""}
addUserKnob {6 norm l Normalize +STARTLINE}
norm true
addUserKnob {7 val l "Pixel Offset" R 0 50}
val 5.2
addUserKnob {26 Matrix}
addUserKnob {3 v1}
v1 1
addUserKnob {3 v2 -STARTLINE}
v2 1
addUserKnob {3 v3 -STARTLINE}
v3 1
addUserKnob {3 v4}
v4 1
addUserKnob {3 v5 -STARTLINE}
v5 1
addUserKnob {3 v6 -STARTLINE}
v6 1
addUserKnob {3 v7}
v7 1
addUserKnob {3 v8 -STARTLINE}
v8 1
addUserKnob {3 v9 -STARTLINE}
v9 1
addUserKnob {26 ""}
addUserKnob {26 About -STARTLINE T "GPUmatrix v0.1 \ntheo@euqahuba.com"}
}



2d Intro, text scrollers, wobblies and triangles. Having fun using Pascal and Asm, had no idea what I was doing but it came out looking like this most of the time.











