Perlin Noise
Perlin noise is a type of gradient noise developed by Ken Perlin.
Perlin noise is most commonly implemented as a two-, three- or four-dimensional function, but can be defined for any
number of dimensions. An implementation typically involves three steps: defining a grid of random gradient vectors,
computing the dot product between the gradient vectors and their offsets, and interpolation between these values.
- Grid definition : Define an n-dimensional grid where each grid intersection has associated with it a fixed random n-dimensional
unit-length gradient vector, except in the one dimensional case where the gradients are random scalars between -1 and 1.
- Dot product : For each corner, we take the dot product between its gradient vector and the offset vector to the candidate point. This
dot product will be zero if the candidate point is exactly at the grid corner.
- Interpolation : The final step is interpolation between the 2n dot products. Interpolation is performed using a
function that has zero first derivative (and possibly also second derivative) at the 2n grid
nodes. Therefore, at points close to the grid nodes, the output will approximate the dot product of the gradient vector
of the node and the offset vector to the node.