Description ​
The GR32.Noise.Simplex unit implements Ken Perlin's Simplex Noise algorithm for 2D, 3D, and 4D evaluation spaces. It provides the TSimplexNoise class, offering fast, smooth, pseudo-random continuous gradient noise with reduced computational overhead and visually superior isotropic isotropy compared to traditional grid-based Perlin noise.
Common Use Cases ​
- Procedural Texture Generation: Synthesizing natural patterns such as clouds, smoke, marble, wood grain, fire, and liquid surfaces without visible grid artifacts or directional bias.
- Terrain & Heightmap Generation: Creating continuous landscape elevation maps and heightfields across 2D spatial coordinates.
- Organic Motion & Particle Swarms: Driving organic motion in 2D or 3D vector fields where 3D or 4D noise (using time
as an extra dimension) produces smoothly evolving forces over time. - Domain Warping & Distortion: Displacing spatial coordinates (
) prior to sampling other patterns or images to simulate turbulence, rippling water, or heat haze.
Mathematical Background ​
Standard classical Perlin noise divides space into a hypercubic grid (
Simplex noise replaces hypercubic grids with a simplical grid (tessellation composed of
- In 2D, a simplex is an equilateral triangle (3 vertices).
- In 3D, a simplex is a tetrahedron (4 vertices).
- In 4D, a simplex is a 5-cell / pentatope (5 vertices).
Because an
1. Coordinate Space Skewing and Unskewing ​
To partition space into simplices, the input coordinate vector
The cell coordinates in skewed space are determined by taking the floor values:
The exact skew and unskew constants for 2D, 3D, and 4D spaces implemented in TSimplexNoise are:
| Dimension | Skew Factor | Unskew Factor | Simplex Shape | Vertices ( |
|---|---|---|---|---|
| 2D | Equilateral Triangle | 3 | ||
| 3D | Tetrahedron | 4 | ||
| 4D | 5-Cell (Pentatope) | 5 |
2. Simplex Traversal & Gradient Kernel Summation ​
- Cell Partitioning: By comparing relative magnitudes of fractional displacements (e.g.
), the algorithm determines the precise simplex traversal order through the corners of the containing simplex. - Pseudo-Random Gradient Hashing: Each vertex index is hashed through a seed-based 512-byte permutation table (
FPerm) to look up a unit gradient vector. - Distance Attenuation Radial Kernel: For each vertex
, the distance vector from the vertex to the evaluation point is calculated in unskewed Euclidean space. The contribution of vertex is governed by a radially symmetric polynomial kernel:
where
Summing the corner contributions
Reference Links ​
- Ken Perlin: "Noise Hardware", Real-Time Shading SIGGRAPH Course Notes (2001). http://www.csee.umbc.edu/~olano/s2002c36/ch02.pdf
- Stefan Gustavson: "Simplex noise demystified", Linköping University, Sweden (2005/2012). https://github.com/stegu/perlin-noise/blob/master/simplexnoise.pdf
- Stefan Gustavson: Simplex Noise 1D-4D Reference Implementation in C. https://github.com/stegu/perlin-noise/blob/master/src/simplexnoise1234.c