Projects, portfolio, and personal work of Joe Pelz

Nuke Expressions

Searching for how to build nuke nodes has probably landed me on a watch list somewhere

Nuke expressions are so cool. It took me a while to understand how to use them but they are really powerful in what they can do. What they let you do is provide an equation for each pixel of the image. You have access to several built in variables, and the ability to define a few of your own. There's a library of built in functions you have access too as well. And it runs fast too!

A (non-comprehensive) rundown of the tools in the expression node are:

Finally! All the simple image manipulations imagined in my mind, I could easily create! So many things are easier and simpler to me, when I just use an expression.

Need to invert the alpha and change its gradient direction? Put this in the alpha channel of an expression node

  1. 1 / (1 - a)

Need a linear-falloff circle shape?

  1. posX = 200
  2. posY = 350
  3. radius = 100
  4. dist = sqrt((x - posX)**2 + (y - posY)**2)
  5. rgba = clamp(1 - dist/radius, 0, 1)

One expression I used recently was to ease into scaling an image to the left of a particular x coordinate. It went like this:

  1. offset = 400
  2. factor = 0.9
  3. valid = x < offset
  4. newX = -(abs(x - offset) ** factor) + offset
  5. r = valid ? r(newX, y) : r
  6. g = valid ? g(newX, y) : g
  7. b = valid ? b(newX, y) : b
  8. a = valid ? a(newX, y) : a

You can take it pretty far with expressions. I built a mandelbrot fractal and kaleidoscope nodes out of expressions. The kaleidoscope was particularly fun to play with.

In summary, nuke nodes are fun. They're worth learning to use and being played around with. They can do some really powerful things if you have the math mind to express what you're trying to do.

Download my collection of saved nuke gizmos here for your fun and learning. Nuke is available for free for non-commercial purposes as of mid-2015. Yay!