Multi-Dimensional
Support for 1D, 2D, and 3D noise generation.
Perlin noise is a type of gradient noise used by visual artists to increase the appearance of realism in computer graphics. This header-only C++ library provides an efficient implementation based on Ken Perlin’s “Improved Noise” algorithm.
Multi-Dimensional
Support for 1D, 2D, and 3D noise generation.
Octave Noise
Generate fractal noise by layering multiple octaves of Perlin noise at different frequencies and amplitudes.
Header-Only
Zero-dependency, single-header library for easy integration into any C++ project.
Deterministic
Produces consistent results across different platforms for the same initial seed.
Integrating the library is as simple as including the header file and initializing the noise generator with a seed.
#include "PerlinNoise.hpp"
int main() { const siv::PerlinNoise::seed_type seed = 123456u; const siv::PerlinNoise perlin{ seed };
// Generate a 2D noise value at (x, y) double val = perlin.noise2D_01(0.5, 0.8);
// Generate 4 octaves of noise for a more complex texture double octVal = perlin.octave2D_01(0.5, 0.8, 4);}The library offers various methods for remapping and normalizing the output noise:
noiseXD: Returns values in the range [-1, 1].noiseXD_01: Returns values remapped to the range [0, 1].Octave functions allow for the creation of more detailed “cloud-like” textures by summing multiple noise layers:
octaveXD(x, y, octaves, persistence)normalizedOctaveXD_01(...)