There are two generic and highly useful built-in noise functions in SL: noise() and cellnoise(). Many exciting things can be done with these alone. However, for some applications they are insufficient, and other noise-like pseudo-random functions are more suitable.
I have prepared four of these, based on other people's published work:
All four can be downloaded with full source code and pre-compiled DSO binaries for the Windows platform, and a Makefile for the Linux platform:
If you are on a Linux platform, you need to compile the binaries yourself by typing "make -f Makefile-Linux". If you are on another Unix platform like MacOS X, you need to adjust the Makefile to suit your compiler and your platform before you recompile. Specifically, for MacOS X the argument to gcc for building a dynamic shared library is -dynamiclib, not -shared. If you are on Windows, the DLL files are already provided for your convenience, but you can also compile them yourself using almost any C compiler for the Windows platform. The Makefile included is for the free Mingw32 compiler.
Note: In January 2008, an embarrassing and serious bug was corrected in the "srdnoise" function. (One of my students found it. Ahem. Sorry.) The pre-compiled DLL was updated accordingly.
Stephen Worley's cellular noise was simply wrapped up in a DSO format by a simple header to interface his code to an SL function named cellularnoise(). I did not do any actual hard-core coding on this function, and all the code in the file cellular.c is Stephen Worley's original work.
Improved noise, in the form of an SL function named improvednoise() was implemented by me from Ken Perlin's Siggraph sketch from 2001. Improved noise is similar to classic Perlin noise, but it has a better continuity and looks better, in particular when used for bump mapping. It also has a simpler and faster implementation than classic Perlin noise as it was originally presented. The ideas are all from Ken Perlin, but most of the actual code is mine. Note that this improved variant of Perlin noise is now used for the SL noise() implementation in Aqsis.
Simplex noise, in the form of an SL function named simplexnoise() was implemented by me from scratch, using only Ken Perlin's verbal descriptions. His Java reference code for 3D simplex noise did not make any sense at all to me until long after I had rewritten the function myself with all new code. I also did the 1D, 2D and 4D versions myself — Ken Perlin presented only the 3D version for reference in his article. Thus, the ideas behind simplex noise are Ken Perlin's, but all the actual code is my own work.
Flow noise was implemented as a more general base function srdnoise(), a version of simplex noise with rotating gradients and an optional computation of the true analytic derivative. The actual "flow noise" fractal sum with perturbation to simulate flow advection needs to be done in SL. This makes the implementation very flexible, and the swirling-noise-with-derivative function is useful for other purposes as well. All the credit for the ideas behind flow noise should be with Ken Perlin and Fabrice Neyret, but all the code for this implementation is my own work. Furthermore, the 3D version is my own extension of the 2D function presented by Perlin and Neyret. I am not claiming that the gradients are uncorrelated so that the 3D noise field has the same statistics for all rotation angles, but I have found it to be good looking and useful for solid texturing with a 3D version of flow noise.
In the aftermath of implementing flow noise, I also wrote C functions for computing the analytic gradient of simplex noise in 1, 2, 3, and 4 dimensions without the extra feature of rotating the gradients. That code is not yet wired into a DSO shadeop, but it is included in the archive above as "sdnoise1234.h" and "sdnoise1234.c". You might find it useful.
The download archives above contain basic RIB and SL examples of use of the four new functions, and the source code is well structured and reasonably well commented, but for detailed descriptions of the actual algorithms, you need to refer to other sources, for example these:
My noise implementations were originally released as free software, under the conditions of the GNU General Public License (GPL). As of February 2011, I have now placed the code in the public domain. Note that Stephen Worley's code is still not quite public domain, but a very mildly restricted license saying "Please retain the comment header identifying me as the author". (I would kindly ask the same of you for my code, although I do not require it.)
Stefan Gustavson (email@example.com), March 2006, most recently updated Septrember 2012