Procedurally generated content is a fairly large movement at this point. The most prominent, recent example is probably Minecraft, which relies heavily upon computer algorithms to generate the world and events in the game. There’s no cubicle farm of artists churning out Minecraft landscapes.
To a large extent, we have Ken Perlin to thank for this. Ken was awarded an Academy Award for the invention of Perlin Noise during the production of the film Tron. His name is now ubiquitous, but unfortunately the algorithm which bears his name is dated. Ken published a paper in 2002 describing the drawbacks of Perlin Noise and introducing a new algorithm. Many references to this algorithm confusingly call it Improved Perlin Noise, but it is actually named Simplex Noise.
It seems many developers start searching for noise functions and don’t know which to use. Thankfully, Simplex Noise is a suitable replacement to Perlin Noise in almost every way: the noise is cleaner, less computationally expensive and easier to implement in hardware (if desired). Unfortunately, with all the confusion on the web it’s hard to find a good implementation and impossible to find documentation.
When I came upon this problem in 2007, the only implementation I could find was written in Java by Stefan Gustavson (Simplex Noise Demystified pdf). I managed to get a nice fast implementation written for my C++ project, but didn’t really write any meaningful documentation. Nevertheless, it must have been the best thing available because I know it’s in use in several places.
Simplex Noise Implementations
I have written C++ and Python implementations of Simplex Noise. In addition to raw 2D, 3D and 4D noise, multi-octave noise functions are also available. There’s an experimental marble texture available and I expect to add a lot more in due time.
Python Simplex Noise (Google Code)
Performance warning: although functional, the Python implementation is currently 100-times slower than the C++ implementation. I will be building a faster Python module, but go ahead and use this version if you’re lazy and/or don’t need to generate more than ~40,000 values per second.
Understanding Simplex Noise and Multi-Octave Noise
If you already understand other types of procedural noise (such as Perlin Noise) then there’s probably not too much to know. On the other hand, you should certainly learn a little more if you’ve never worked with noise before. Having a basic understanding will allow you to write better-performing, better-looking code.
Simplex Noise on wikipedia.
Multi-octave noise is much more desirable for certain situations (such as generating terrain). You’ll be able to take better advantage of it if you understand basically how it works: Explanation of multi-octave noise
Stefan Gustavson’s Simplex Noise Demystified (pdf) explains the benefits of Simplex noise and how it works.
Some plots of the noise distributions are available on the Google Code wiki.
Using Simplex Noise
If you already know what you’re doing it should be easy to determine which functions you need to call. I’ve made a number of convenience functions available and you can certainly produce new ones easily. Each function takes a set of 2D, 3D or 4D coordinates and returns a single noise value. These are the functions available:
raw_noise() returns the value directly from the Simplex noise function.
scaled_raw_noise() scales the return value from [-1, 1] to [loBound, hiBound] based on the bounds you specify.
octave_noise() returns a multi-octave noise value based on multiple passes of Simplex noise.
scaled_octave_noise() returns a multi-octave noise value based on multiple passes of Simplex noise. Scales the return value from [-1, 1] to [loBound, hiBound] based on the bounds you specify.