Skip to content
Sample of Fractional Brownian Motion noise

hodgin_iquilezles · FBMNoise

Fractional Brownian Motion noise

Quilez's canonical fBM: a 2D value-noise base summed over N octaves whose frequency doubles and amplitude is multiplied by G = exp2(-H) per octave. With H = 1 (G = 0.5) the result is the popular isotropic 'yellow noise' used to model terrain, clouds and bark; lower H is wilder, higher H is smoother. Each step advances the domain offset, producing slow continuous evolution across the canvas.

Original: https://iquilezles.org/articles/fbm/

▶ Try the live demo (JS port) ▶ Run reference.py via Pyodide 10 formulas have instant JS ports. The Pyodide path runs the actual Python in your browser — first load is ~6 MB, then instant.

Family
hodgin_iquilezles
Source
hodgin × iquilezles
Evolution
noise_field
Render
scalar_field
Complexity
low
Agents
0
Year
2022
Author
Inigo Quilez

Math essence

fbm(x) = sum_{k=0..N-1} G^k * noise(2^k * x + offset_k) where noise(.) is a smoothly-interpolated value noise built from a 32-bit integer hash. Hurst exponent H in [0,1] determines G = exp2(-H); the canonical 'yellow noise' corresponds to H = 1 (G = 0.5). Optional domain offset slides the field across the canvas to simulate animation.

Parameters

Name Type Default Range Description
dim int 360 120–800 Square output size in pixels.
scale float 4 1–32 Number of base-noise cells across the canvas.
octaves int 6 1–9 Number of stacked octaves.
hurst float 1 0.05–1 Hurst exponent H; G = exp2(-H). H=1 -> canonical 'yellow noise'.
contrast float 1.1 0.25–4 Post-field contrast multiplier.
offset_x float 0 -10–10 Initial x domain offset.
offset_y float 0 -10–10 Initial y domain offset.

Reference

First 60 lines of reference.py. Full source: library_external/hodgin_iquilezles/FBMNoise/reference.py

from __future__ import annotations

from typing import ClassVar

import numpy as np


def _hash1(ix: np.ndarray, iy: np.ndarray, seed: int) -> np.ndarray:
    ix = ix.astype(np.uint64, copy=False)
    iy = iy.astype(np.uint64, copy=False)
    h = (ix * np.uint64(0x27D4EB2F165667C5)) ^ (
        iy * np.uint64(0x165667B19E3779F9)
    ) ^ (np.uint64(np.int64(seed) & 0xFFFFFFFF) * np.uint64(0x9E3779B97F4A7C15))
    h &= np.uint64(0xFFFFFFFFFFFFFFFF)
    h ^= h >> np.uint64(33)
    h *= np.uint64(0xFF51AFD7ED558CCD)
    h &= np.uint64(0xFFFFFFFFFFFFFFFF)
    h ^= h >> np.uint64(33)
    h *= np.uint64(0xC4CEB9FE1A85EC53)
    h &= np.uint64(0xFFFFFFFFFFFFFFFF)
    h ^= h >> np.uint64(33)
    out = (h & np.uint64(0xFFFFFFFF)).astype(np.float64) / 4294967296.0
    return out.astype(np.float32)


class FBMNoise:
    """Fractional Brownian Motion noise — Inigo Quilez (iquilezles.org).

    Quilez's article *fbm* (https://iquilezles.org/articles/fbm/) describes
    the canonical fBM accumulation:

        float fbm( in vec2 x, in float H ) {
            float G = exp2(-H);
            float f = 1.0, a = 1.0, t = 0.0;
            for ( int i = 0; i < numOctaves; i++ ) {
                t += a * noise( f * x );
                f *= 2.0;
                a *= G;
            }
            return t;
        }

    With ``G = 0.5`` (H=1) we get the popular "yellow noise" / isotropic
    fBM used for terrain, clouds, bark and many natural textures.  We use
    a 2D value-noise base (Quilez's hash22 → dot/rand) and expose both
    ``H`` and the number of octaves.
    """

    family: ClassVar[str] = "hodgin_iquilezles"
    sketch: ClassVar[str] = "fbmnoise"

    def __init__(
        self,
        dim: int = 360,
        scale: float = 4.0,
        octaves: int = 6,
        hurst: float = 1.0,
        contrast: float = 1.1,
        offset_x: float = 0.0,
        offset_y: float = 0.0,

Try running it locally

The reference implementation is self-contained Python with numpy. Install the package and run:

python library_external/hodgin_iquilezles/FBMNoise/reference.py

Need help? See Learn for the standard environment setup, or Playground for an in-browser sketchbook.

More from hodgin × iquilezles

Sample of Boids Flock (Hodgin Murmuration)

Boids Flock (Hodgin Murmuration)

hodgin_iquilezles · BoidsFlock

A 2D flock of boids steered by Craig Reynolds' three classic rules (separation, alignment, cohesion) over a coarse spatial-hash neighbor query.

View →
Sample of Magneto Particles (Hodgin Magnetosphere)

Magneto Particles (Hodgin Magnetosphere)

hodgin_iquilezles · MagnetoParticles

Particles pulled and pushed by N orbiting magnetic anchors whose charges flip sign over time.

View →
Sample of Mulberry32 PRNG (stratified scatter)

Mulberry32 PRNG (stratified scatter)

hodgin_iquilezles · Mulberry32RNG

Mulberry32 is a tiny 32-bit-state pseudo-random number generator popularised in the demoscene and used pervasively by Quilez and other graphics programmers as the RNG inside procedural sketches.

View →
Sample of Saturn Rings (orbital resonance)

Saturn Rings (orbital resonance)

hodgin_iquilezles · SaturnRings

Thousands of particles are initialized in an annulus between inner_radius and outer_radius around a central mass, with circular orbital velocities v = sqrt(M/r).

View →
Sample of Smooth-Minimum SDF field

Smooth-Minimum SDF field

hodgin_iquilezles · SmoothMinSDF

Two animated 2D SDF primitives (a moving circle and a translating slab) are blended with Quilez's quadratic-polynomial smooth-minimum and rendered as a scalar field.

View →
Sample of Worley / Cellular Noise

Worley / Cellular Noise

hodgin_iquilezles · WorleyNoise

Quilez's classic 2D Worley noise: a unit grid of cells, each containing one pseudo-random feature point placed by a 2D integer hash.

View →

See all hodgin_iquilezles artworks →