Perlin noise

From Algorithmist
Jump to navigation Jump to search

Perlin noise is a means of a random texture or field.

Generator[edit]

Perlin noise depends on not only random numbers, but a means to consistently recreate these numbers. A linear congruential generator is minimally suitable for this task.

The noise generation function should return a rational number between -1 and 1, and may need to handle upto four parameters.

Smoothing[edit]

Each integer point within the noise field is smoothed by taking values from nearby neighbours, the fastest method being a weighted average. For example, each neighbor in the raw 1-dimensional field may have 25% of its value applied to the average, while the current raw value may provide 50% of its value.

In a two dimensional field, the same concept applies.

Interpolation[edit]

If a point in a noise field fractional, it needs to be interpolated among the closest points. Valid forma of interpolation include:

Iteration[edit]

The final stage in Perlin noise is iteration. It requires two parameters: persistance (normally between 0 and 1) and iterations (>=1).

Persistance, if closer to 1, produces a more chaotic field.

Pseudo code may look like this:


frequency = 1
amplitude = 1;

for each iteration:
  total = total + Noise (x * frequency) * amplitude
  frequency = frequency * 2
  amplitude = amplitude * persistance

Each iteration is more chaotic than the previous value, but is less powerful.

External links[edit]

This is a stub or unfinished. Contribute by editing me.