worleyNoise

A complete cellular-noise paint: distances to drifting cell points, read through the color ramp.

worleyNoise(slots: {
    scale: PropRef
    jitter: PropRef
    lacunarity: PropRef
    persistence: PropRef
    contrast: PropRef
    balance: PropRef
    seed: PropRef
    /** Compile-time prop: `'f1' | 'f2' | 'f2MinusF1' | 'f1PlusF2' | 'f1TimesF2'`. */
    mode: PropRef
    /** Compile-time prop: `'euclidean' | 'manhattan' | 'chebyshev'`. */
    distance: PropRef
    /** Compile-time prop: 1 to 4. */
    octaves: PropRef
    space: PropRef
}): Paint

Import noise from shaders/std and use noise.worleyNoise.

scale is the number of cells across (1 to 30) and jitter how far the points wander from a grid (0 = rigid grid, 1 = random). mode picks the distance field: 'f1' (cells), 'f2', 'f2MinusF1' (edges), 'f1PlusF2', 'f1TimesF2'. distance picks the cell shape: 'euclidean' (round), 'manhattan' (diamond), 'chebyshev' (square). octaves (1 to 4) stacks finer layers, with lacunarity and persistence setting how much finer and weaker. contrast is a multiplier (1 = unchanged) and balance a shift. Low values read the first color. mode, distance and octaves are compile-time props. Reads the definition's colorA, colorB and, when present, stops props.

Parameters

NameTypeNotes
slots`{
scale: PropRef
jitter: PropRef
lacunarity: PropRef
persistence: PropRef
contrast: PropRef
balance: PropRef
seed: PropRef
/** Compile-time prop: `'f1' \| 'f2' \| 'f2MinusF1' \| 'f1PlusF2' \| 'f1TimesF2'`. */
mode: PropRef
/** Compile-time prop: `'euclidean' \| 'manhattan' \| 'chebyshev'`. */
distance: PropRef
/** Compile-time prop: 1 to 4. */
octaves: PropRef
space: PropRef

}` | |

Example

paint: worleyNoise({scale: p('scale'), jitter: p('jitter'), lacunarity: p('lacunarity'), persistence: p('persistence'), contrast: p('contrast'), balance: p('balance'), seed: p('seed'), mode: p('mode'), distance: p('distance'), octaves: p('octaves'), space: p('colorSpace')})

Tip. Give the mode and distance props transformWorleyMode and transformWorleyDistance as their transform.

See also

  • cellDistances — Distances from each pixel to its nearest two cell points, as (d1, d2): the raw material for Voronoi fills and borders.
  • transformWorleyMode — The transform for a worleyNoise mode prop: maps 'f1', 'f2', 'f2MinusF1', 'f1PlusF2' or 'f1TimesF2' to the number the paint reads.
  • transformWorleyDistance — The transform for a worleyNoise distance prop: maps 'euclidean', 'manhattan' or 'chebyshev' to the number the paint reads.
  • fractalNoise — A complete fractal-noise paint: layered simplex noise that morphs over time, read through the color ramp.

Used by

WorleyNoise