The available noise functions are given in Tables 3.6, 3.7, and 3.8. Noise functions are useful in many situations, for instance, to give a surface an organic appearance. Each of these functions can compute N channels of noise on an M-dimensional input space.
The hash function procedurally computes a floating-point number which is a deterministic function of its input. Inputs with different integer parts will result in outputs that appear to be unrelated to one another. The texhash function is similar, but uses a lookup table stored in a texture. It may be faster to use texhash on some targets, although this limits the resolution of the hash function. Neither function is guaranteed (at present) to be the same on all platforms. Both hash functions depend only on the integer part of their inputs.
The cellnoise function is an interface to either hash or texhash, depending on compilation target and a global option. For instance, on GPU vertex shader targets that don’t support texture maps, cellnoise must use the procedural function hash. The rest of the noise functions are built on top of cellnoise.
The noise function implements the original Perlin noise function [?], and the perlin function implements the “new and improved” (but more expensive) Perlin noise function [?]. A cheaper noise function that can replace Perlin noise in some circumstances is provided by linnoise, which just linearly interpolates cellnoise.
These noise functions can compute and sum several octaves of noise, with a different weight for each octave. For instance, if noise(a) is the basic Perlin noise, we support a generalization as follows:
The basic noise functions return values in the range [0,1]. The versions prefixed with “s” return values in the range [-1,1].
The turbulence function computes a weighted sum of octaves of absolute values of snoise:
The worley function approximates the Worley basis functions [?], which are based on the Kth distance to randomly placed points (centers). Our implementation currently uses a jittered grid of centers rather than a true random distribution. The value returned by the worley function is a weighted combination of the distances to the Kth closest centers. The maximum size of K is 3M.
The weight vectors are optional and if not given, a weight of 1 is assumed and one octave (or the closest distance in the case of worley) is computed.
Some of these noise functions may be quite expensive, especially at higher input dimensionalities. The worley and perlin functions, as well as related functions such as turbulence, may compile to a large number of instructions on backends which do not have a hash function or noise built in (which is all of them at the time this was written). In fact, the implementation of worley will grow exponentially with dimension.
|
|
|
Note: This manual is available as a bound book from AK Peters, including better formatting, in-depth examples, and about 200 pages not available on-line.