Perlin and Simplex Noise for Terrain

Updated June 2026
Perlin noise and simplex noise are gradient-based noise functions that produce smooth, natural-looking random values. They are the foundation of procedural terrain generation, texture synthesis, and countless other effects in game development. This guide walks through how these functions work, how to layer them for realistic results, and how to tune their parameters to achieve specific terrain styles.

Noise functions are the most widely used building block in procedural generation. Unlike simple random number generators that produce independent, uncorrelated values, noise functions produce values that vary smoothly across space. Neighboring points return similar values, creating the gradual transitions that characterize natural phenomena like hills, clouds, and ocean waves.

Understand the Noise Function Fundamentals

Ken Perlin created Perlin noise in 1983 while working on visual effects for the film Tron. The algorithm works by placing random gradient vectors at the corners of a regular grid. For any point in space, the algorithm identifies which grid cell contains it, computes the dot product between each corner's gradient vector and the vector from that corner to the sample point, then interpolates these dot products using a smooth fade function (typically a quintic polynomial) to produce the final value.

The result is a continuous function that returns values between -1 and 1, varies smoothly with no sharp discontinuities, and has a characteristic frequency determined by the grid spacing. The output looks like gently rolling hills when visualized as a heightmap, or soft, cloud-like blobs when rendered as a grayscale image. Perlin received a Technical Achievement Academy Award in 1997 for this contribution to computer graphics.

Simplex noise, introduced by Perlin in 2001, improves the original algorithm in several important ways. Instead of a square grid, it uses a simplex grid, which means triangles in 2D and tetrahedra in 3D. This change reduces the number of corner contributions needed per sample point (from 4 to 3 in 2D, from 8 to 4 in 3D), lowering computational cost. It also eliminates the axis-aligned visual artifacts that sometimes appear in classic Perlin noise. OpenSimplex noise, an open-source alternative created by Kurt Spencer, provides similar quality without the patent concerns that once surrounded simplex noise.

For practical game development, the choice between Perlin noise and simplex noise rarely matters for 2D applications, as both produce visually similar results. In 3D and higher dimensions, simplex noise is faster and produces cleaner output. Most modern noise libraries default to simplex or OpenSimplex implementations.

Layer Multiple Octaves with Fractal Brownian Motion

A single layer of noise produces gentle, featureless terrain. Real landscapes have detail at every scale, from continental mountain ranges down to individual boulders and pebbles. Fractal Brownian motion (fBm) achieves this multi-scale detail by summing multiple layers of noise, called octaves, each at a different frequency and amplitude.

The first octave uses a low frequency and high amplitude, creating the broad shape of the terrain: the location of mountain ranges, valleys, and plains. The second octave doubles the frequency and halves the amplitude, adding medium-scale features like individual peaks and ridges. Each subsequent octave adds finer detail: rocky outcrops, ledges, surface roughness. Summing 4 to 8 octaves typically produces terrain with convincing multi-scale detail.

The key parameters are lacunarity and persistence. Lacunarity controls the frequency multiplier between successive octaves. A lacunarity of 2.0 means each octave has twice the frequency of the previous one, which is the standard value that mimics fractal patterns found in nature. Persistence controls the amplitude multiplier. A persistence of 0.5 means each octave contributes half the height of the previous one. Lower persistence produces smoother terrain with subdued small-scale detail. Higher persistence produces rougher, more jagged terrain where fine details compete with the broad features.

The mathematical formula for fBm is: for each octave i from 0 to n, sum noise(x * frequency * lacunarity^i) * amplitude * persistence^i. The total value is this sum, which you then normalize or clamp to your desired height range.

Tune Parameters for Your Terrain Style

Different parameter combinations produce dramatically different terrain characters. Understanding what each parameter controls lets you dial in the exact look your game needs.

Number of octaves controls the level of detail. Two octaves produce smooth, rolling terrain suitable for a calm grassland. Six to eight octaves produce highly detailed terrain with visible features at every zoom level, appropriate for a mountainous wilderness. More octaves increase computation time linearly, so balance detail against performance requirements, especially for real-time generation.

Amplitude controls the maximum height difference. A high amplitude creates dramatic elevation changes with towering peaks and deep valleys. A low amplitude creates subtle, gentle terrain. For a game where terrain is mostly a backdrop, low amplitude keeps the landscape unobtrusive. For a game where terrain is a gameplay obstacle, high amplitude creates meaningful vertical challenges.

Frequency (or scale) controls how tightly packed the terrain features are. Low frequency produces large, sweeping features spread across the map. High frequency produces many small features close together. The initial frequency of the first octave sets the overall scale of the terrain, so this value determines whether your map has one mountain range or twenty.

Redistribution reshapes the noise output curve after generation. Raising the noise value to a power greater than 1.0 creates terrain with flat lowlands and steep peaks, mimicking the sharp ridges of real mountain ranges. Applying a terrace function creates stepped, mesa-like terrain. These post-processing operations add character without changing the underlying noise algorithm.

Apply the Heightmap to Your Game World

Once you have a noise-based heightmap, you need to map it to visual or gameplay elements. The simplest approach assigns colors based on elevation thresholds: values below 0.3 become water (blue), values from 0.3 to 0.4 become sand (tan), values from 0.4 to 0.7 become grass (green), values from 0.7 to 0.85 become rock (gray), and values above 0.85 become snow (white). This produces a recognizable terrain map from just five color rules applied to a single noise layer.

For a 2D tile-based game, you can quantize the noise values into discrete tile types. Each threshold maps to a different tile, and autotiling rules handle the transitions between adjacent tiles. For a 3D game, the heightmap directly controls vertex positions in a terrain mesh, with texture blending based on elevation and slope angle.

Adding a second, independent noise layer for moisture creates more varied biomes. By combining the elevation map with the moisture map, you can assign biomes using a Whittaker diagram: low elevation plus high moisture produces swamp, high elevation plus low moisture produces rocky desert, and moderate values of both produce temperate forest. This two-noise approach produces much more varied landscapes than elevation alone.

For chunk-based games that generate terrain on demand, each chunk samples the global noise function at its world coordinates. Because noise functions are stateless and deterministic, any chunk can be generated independently without knowledge of its neighbors, and chunks generated in any order will tile together seamlessly at their boundaries.

Add Domain Warping for Organic Variation

Domain warping, sometimes called domain distortion, feeds noise output back as input coordinates to create twisted, flowing terrain features that look more organic than raw noise output. Instead of sampling noise at position (x, y), you sample at (x + noise1(x, y), y + noise2(x, y)), where noise1 and noise2 are separate noise functions. The result is terrain that appears to flow and swirl, mimicking natural processes like tectonic folding and glacial carving.

The intensity of the warping determines how distorted the terrain becomes. Subtle warping adds organic irregularity to otherwise uniform terrain features. Strong warping creates surreal, alien landscapes with flowing ridges and spiral formations. Many stylized games use domain warping to create terrain that is recognizably terrain-like but clearly not Earth-like.

Multi-level domain warping applies the technique recursively. The warped coordinates are fed through another noise function, and the result is used to warp a third noise function. Each level of recursion adds more complexity and organic character. Two levels of warping are typically sufficient, as the visual returns diminish rapidly beyond that.

Domain warping is computationally inexpensive because it reuses the existing noise functions with modified inputs. The cost is just a few additional noise evaluations per sample point, making it one of the most cost-effective ways to improve the visual quality of procedural terrain.

Key Takeaway

Perlin and simplex noise provide the smooth, natural randomness that terrain generation requires. By layering multiple octaves with fractal Brownian motion and tuning lacunarity, persistence, and redistribution, you can produce terrain ranging from gentle rolling hills to jagged mountain ranges, all from a single algorithmic foundation.