Single-header C99/C11 noise synthesis library for games, diffusion, sampling, and HPC.
noize.h implements a spectral noise pipeline: fill a grid with spatial or random
data, transform to frequency domain via FFTW, apply spectral filters, transform back,
and optionally blend and temper the result. All functions are static inline — just
include the header.
- Spectral filters: power-law (white/pink/brown/blue/violet), Matern, Gaussian, Butterworth (low/high/band-pass), tempered Cauchy, VG-log, alpha-stable, fBm
- Full pipeline: spatial base -> FFT -> filter -> IFFT -> blend -> temper
- Distributions: Ziggurat Gaussian (128 layers), Gamma, Variance-Gamma, Cauchy
- Spatial: value / Perlin / simplex / Worley (1D–3D), Poisson-disk
- QMC: Sobol (Joe–Kuo, up to 2049 dimensions), Halton, R-sequence
- PRNG: xoshiro256** with 4-lane multi-stream
- NEON: vectorized paths for aarch64 (filter application, normalization, temper)
- Optional SIGMA integration for advanced RNG/allocator/distribution backends
#include "noize.h"
#include <stdio.h>
int main(void)
{
enum { NX = 256, NY = 256 };
float out[NX * NY];
noize_noise_t ctx;
noize_noise_init(&ctx, NX, NY, 42);
noize_pink(&ctx, out); /* 256x256 pink noise field */
noize_noise_free(&ctx);
return 0;
}Compile:
gcc -std=c11 -O3 -march=native -I include example.c -lfftw3f -lmC++17 (FastNoiseLite-shaped API):
#include "noize.hpp"
noize::Noise n;
n.SetNoiseType(noize::Noise::NoiseType_Perlin);
n.SetFrequency(0.02f);
float v = n.GetNoise(x, y);
noize::Field field(256, 256, 42);
auto pink = field.pink();mkdir build && cd build
cmake .. -DNOIZE_BUILD_TESTS=ON -DNOIZE_BUILD_BENCHMARKS=ON -DNOIZE_BUILD_EXAMPLES=ON
cmake --build .
ctest --output-on-failureOptions:
| Option | Default | Description |
|---|---|---|
NOIZE_BUILD_TESTS |
ON | Build test suite |
NOIZE_BUILD_BENCHMARKS |
OFF | Build bench_main / bench_cpp |
NOIZE_BUILD_EXAMPLES |
ON | Build example programs |
NOIZE_BENCH_FASTNOISELITE |
OFF | Fetch FastNoiseLite and build bench_fnl |
NOIZE_USE_SIGMA |
OFF | Enable SIGMA integration |
Comparison bench (needs network at configure time):
cmake .. -DNOIZE_BENCH_FASTNOISELITE=ON
cmake --build . --target bench_fnl
./benchmarks/bench_fnlAfter installation, downstream projects use:
find_package(noize REQUIRED)
target_link_libraries(myapp PRIVATE noize::noize)noize_noise_t ctx;
noize_noise_init(&ctx, nx, ny, seed);
noize_pink(&ctx, out); /* 1/f noise */
noize_brown(&ctx, out); /* 1/f^2 noise */
noize_blue(&ctx, out); /* f noise */
noize_violet(&ctx, out); /* f^2 noise */
noize_matern(&ctx, out, nu, lambda); /* Matern covariance */
noize_gaussian_field(&ctx, out, sigma); /* Gaussian (squared-exp) */
noize_fbm(&ctx, out, H); /* fractional Brownian motion */
noize_cat(&ctx, out, blend, lambda, temper); /* tempered Cauchy */
noize_noise_free(&ctx);noize_fill_gaussian(&ctx, out, n); /* N(0,1) via Ziggurat */
noize_fill_vg(&ctx, out, n, kappa, theta, sigma); /* Variance-Gamma */
noize_fill_cauchy(&ctx, out, n, gamma); /* Cauchy */float v1 = noize_value1(x); /* value noise 1D */
float v2 = noize_value2(x, y); /* value noise 2D */
float v3 = noize_value3(x, y, z); /* value noise 3D */
float p1 = noize_perlin1(x); /* Perlin 1D */
float p2 = noize_perlin2(x, y); /* Perlin 2D */
float p3 = noize_perlin3(x, y, z); /* Perlin 3D */
float s1 = noize_simplex1(x, seed); /* simplex 1D (seeded) */
float s2 = noize_simplex2(x, y, seed); /* simplex 2D (seeded) */
float s3 = noize_simplex3(x, y, z, seed); /* simplex 3D (seeded) */
float w1 = noize_worley1(x, seed); /* Worley / cellular 1D */
float w2 = noize_worley2(x, y, seed); /* Worley / cellular 2D */
float w3 = noize_worley3(x, y, z, seed); /* Worley / cellular 3D */
float s = noize_sobol(index, scramble); /* 1D Sobol / van der Corput */
noize_poisson_disk(&prng, w, h, radius, k, &result); /* Poisson-disk 2D */float h = noize_halton(i, dim); /* Halton, dim 0..15 */
float hs = noize_halton_scrambled(i, dim, seed); /* hashed-digit scramble */
float s1 = noize_sobol_at(i, dim); /* dim 0..2048, Joe–Kuo */
float p8[8];
noize_sobol_fill(i, 8, p8); /* 8D sample i */
noize_sobol_nd_t sob;
noize_sobol_nd_init(&sob, 3);
float p3[3];
noize_sobol_nd_next(&sob, p3); /* 3D Sobol */
noize_rseq_t rs;
float p2[2];
noize_rseq_init(&rs, 2, 0.5); /* Roberts R-sequence */
noize_rseq_next(&rs, p2);noize_filter_params_t p;
noize_filter_params_default(&p);
p.beta = -1.0f;
noize_noise_hybrid(&ctx, out, NOIZE_BASE_GAUSSIAN, NOIZE_FILTER_POWER,
&p, 0.0f, NOIZE_BLEND_ARITHMETIC, 0.0f, 0.0f, 0);noize_hard_temper(data, n, tau); /* clamp to [-tau, tau] */
noize_soft_temper(data, n, tau); /* tanh soft-clip */Thin RAII facade. noize::Noise follows
FastNoiseLite: SetSeed,
SetFrequency, SetNoiseType, SetFractalType, GetNoise(x,y[,z]),
DomainWarp. OpenSimplex2 maps to simplex, Cellular to Worley.
noize::Field owns the FFT context (pink(), matern(), …).
noize::Poisson and noize::Sobol wrap Poisson-disk and Joe–Kuo Sobol.
For projects using SIGMA, define
NOIZE_USE_SIGMA before including the header. This replaces the built-in PRNG and
distributions with SIGMA's backends.
#define NOIZE_USE_SIGMA
#include <sigma/sigma.h>
#include "noize.h"examples/pink_noise.c— generate pink noise, output PGM imageexamples/terrain.c— Matern terrain heightfield, output PGMexamples/poisson.c— Poisson-disk point cloud, output text
MIT. See LICENSE.