Perlin Noise

Another important way to simulate randomness is using Perlin noise generation. Perlin noise generation differs from random generation as it uses a “smooth” sequence of psuedo random numbers, where a singular value in a sequence depends on its predecessors. This is especially useful in creating natural phenomena such as clouds and the textures of materials like marble or wood.

For Perlin noise to work, it is defined in an infinite n-dimensional space with the co-ordinates bound to be between 0.0 and 0.1 and fixed to a semi random number. It is somewhat similar to an audio signal, working within octaves, which are combined to get the final result.

As you can see in the sketch below, the circle seems to “breathe” in and out as it grows and shrinks as although the value is random, it is based on the value that went before it.

In Processing Perlin noise can be used in 2 and 3 dimensions as well to create natural looking textures. Say for example you used Perlin noise to calculate brightness of pixels. The pixels would form clumps of brightness as each individual pixel’s brightness is determined by the brightness of pixels that are around it. Take for example the below sketch:

Here the noiseDetail class is used to change the output of Perlin noise. The box on the left has less detail as it uses less octaves (3 as opposed to 8) and it also has a lower falloff value (0.5 compared to 0.65.) The falloff value is the impact each octave will have on the lower octave. At default it is 0.5.

This will be very useful is I want to recreate organic motion or patterns in the future and is often used in CGI as a low-cost way to create natural textures and structures.

Shiffman, D., 2012. The Nature of Code [online] Mountain View: Creative Commons.

Processing 2. 2014. noise(). Available: https://processing.org/reference/noise_.html. Last accessed 18.11.2014.

Processing 2. 2014. noiseDetail(). Available: https://processing.org/reference/noise_.html. Last accessed 18.11.2014.

Shiffman, D. 2008. CHAPTER 13: EXAMPLE 13-4: PERLIN NOISE. Available: http://www.learningprocessing.com/examples/chapter-13/example-13-4-perlin-noise/. Last accessed 18.11.2014.

Leave a Reply