Simplex 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 four steps: coordinate skewing, simplicial subdivision, gradient selection, and kernel summation.
An input coordinate is transformed using the formula
where
This has the effect of placing the coordinate on an A*n lattice, which is essentially the vertex arrangement of a hypercubic honeycomb that has been squashed along its main diagonal until the distance between the points (0, 0, ..., 0) and (1, 1, ..., 1) becomes equal to the distance between the points (0, 0, ..., 0) and (1, 0, ..., 0).
The resulting coordinate (x', y', ...) is then used in order to determine which skewed unit hypercube cell the input point lies in, (xb' = floor(x'), yb' = floor(y'), ...), and its internal coordinates (xi' = x' − xb', yi' = y' − yb', ...).
Once the above is determined, the values of the internal coordinate (xi', yi', ...) are sorted in decreasing order, to determine which skewed Schläfli orthoscheme simplex the point lies in. Then the resulting simplex is composed of the vertices corresponding to an ordered edge traversal from (0, 0, ..., 0) to (1, 1, ..., 1), of which there are n! possibilities, each of which corresponds to a single permutation of the coordinate. In other words, start with the zero coordinate and successively add-ones starting in the value corresponding to the largest internal coordinate's value, ending with the smallest.
For example, the point (0.4, 0.5, 0.3) would lie inside the simplex with vertices (0, 0, 0), (0, 1, 0), (1, 1, 0), (1, 1, 1). The yi' coordinate is the largest, so it is added first. It is then followed by the xi' coordinate, and finally zi'.
Each simplex vertex is added back to the skewed hypercube's base coordinate and hashed into a pseudo-random gradient direction. The hash can be implemented in numerous ways, though most often uses a permutation table or a bit manipulation scheme.
Care should be taken in the selection of the set of gradients to include, to keep directional artifacts to a minimum.
The contribution from each of the n + 1 vertices of the simplex is factored in by a summation of radially symmetric kernels centered around each vertex. First, the unskewed coordinate of each of the vertices is determined using the inverse formula
This point is subtracted from the input coordinate to obtain the unskewed displacement vector. This unskewed displacement vector is used for two purposes:
From there, each vertex's summed kernel contribution is determined using the expression
where r2 is usually set to either 0.5 or 0.6: the value 0.5 ensures no discontinuities, whereas 0.6 may increase visual quality in applications for which the discontinuities are not noticeable; 0.6 was used in Ken Perlin's original reference implementation.
Uses of implementations in 3D and higher for textured image synthesis were covered by U.S. patent 6,867,776, if the algorithm were implemented using the specific techniques described in any of the patent claims, which expired on January 8, 2022.
Ken Perlin, Noise hardware. In Real-Time Shading SIGGRAPH Course Notes (2001), Olano M., (Ed.). (pdf) http://www.csee.umbc.edu/~olano/s2002c36/ch02.pdf ↩
Ken Perlin, Making noise. Based on a talk presented at GDCHardcore (Dec 9, 1999). (url) http://www.noisemachine.com/talk1/32.html ↩
"image processing - Why does increasing simplex noise dimension wash it out?". Computer Graphics Stack Exchange. Retrieved 2021-03-10. https://computergraphics.stackexchange.com/questions/4212/why-does-increasing-simplex-noise-dimension-wash-it-out ↩