Noise For Distortion in Nuke

Software: NukeX 9.0v6

Difficulty: 3/10

Noise has plenty of functions across every CG package. It can be useful for a smorgasbord of tasks, but seems to have this cloud over its head of being grossly underused, which is a shame because noise can offer a level of detail and complexity that masks the workflow of a shot from even the most seasoned artist.

What are we working with?

So what are we working with? An image is essentially a grid of squares, where each square stores a value. In mathematics it is a two-dimensional Cartesian Coordinates system. Each pixel has a coordinate and a set of values that return a color. That much is simple.

If you want a fun refresher, Matt Parker does a hilarious routine on the similarities between spreadsheets and images here.

UVs for distortion.

Now lets do something slightly more interesting. If we were to take the values in the X dimension of those pixel coordinates and map them onto the red channel, we’d get a gradient going from black to white. Similarly, if we mapped the Y dimension onto our green channel, we’d get a gradient from black to white, but this time in the Y axis. This is an ST Map in its most basic form. When used for lens distortion, computers are able to work out the difference between a mathematically perfect grid and a lens grid shot through a camera, and the resulting map created contains a perfect UV layout (where P = (u,v)) that has been distorted according to the lens grid.

What we can do is feed the ST map some different distortion data, and use it to drive distortion in our image.

Generating ST Maps in Nuke.

Generating an ST Map is super easy. We essentially need two ramps as described above. One in our X dimension, and one in our Y dimension. Our X dimension can then be shuffled completely into the red channel, and the Y dimension can be shuffled completely into the green channel, as shown here:


If all goes to plan, you should have an image that looks like this:


Now that we have this set up, we can start making changes to the map. What I’m going to do is put down a noise node and multiply the X dimension of the image against the noise, which will change the values in our X dimension. I’m also going to use a grade node to up the black point of the image, so we aren’t multiplying against pure black.


Assuming all is good, you should now have this result:


Practical Applications Using The iDistort.

So that’s all very well, but lets assume we don’t need to generate ST Maps. Let’s just distort the image by some noise pattern. For this, I’m going to need a noise, a copy and an iDistort. The setup looks like this:


In this case, we just need to copy our red and green channels from the noise, into the forwardU and forwardV channels of whatever image we want to distort. Then within the iDistort, we want to use the forward channel for our UVs.

The results should look like this:


So this is essentially distorting our image in each dimension, based on the values of our noise. The higher the value of the noise, the greater the distortion. You can see this if you place the noise and the distorted image side-by-side.


So that’s the most basic level of distortion we can do using the iDistort.

But let’s try something more complex.

Distorting the noise with more noise. 

So noise is generated based on the position value of the coordinates it is applied to, and there are so many types of noise. If you are a Houdini user you will be familiar with:

Turbulence Noise

Anti-Aliased Noise

Anti-Aliased Flow Noise

Worley Cellular Noise

Sparse Convolution Noise

Perlin Noise

Alligator Noise

Zero Centered Noise

Voronoi Noise

The list is pretty long.

Let’s try distorting our noise with a different type of noise before distorting our image.


So by using this setup, I am able to get some really interesting results. I started with these two noise patterns:


And by implementing the same setup we’ve used previously, I achieved this result:


What’s so cool about this is we can do it recursively. We can do it over and over again, and we never lose control of the various levels of noise at any stage. We can modify them at any time, and the beauty of Nuke’s procedural system is that it doesn’t break when we make changes upstream.

So when we apply this noise onto our checkerboard we get this result:


What I love about this is the ease with which you can achieve detail. This image is 3840×2160 and we can really see some awesome details coming through. Noise is a critical tool, and can be used in a variety of ways, which I hope to explore further in the future!

I hope this was helpful!