noise(x, y, z)

The noise() function generates coherent pseudo-random values using Perlin noise. It takes up to three coordinates and returns a value between -1 and 1, creating smooth transitions between adjacent coordinates.

Syntax

noise(x)
noise(x, y)
noise(x, y, z)

Parameters

  • x - The x-coordinate in the noise space

  • y (optional) - The y-coordinate in the noise space

  • z (optional) - The z-coordinate in the noise space

Return Value

A number between -1 and 1, representing the noise value at the given coordinates.

Description

Perlin noise is a type of gradient noise that produces natural-looking random patterns. Unlike pure random values, Perlin noise creates smooth transitions between values, making it ideal for:

  • Generating terrain

  • Creating natural-looking textures

  • Simulating organic movement

  • Procedural content generation

The function can be called with one, two, or three parameters to generate 1D, 2D, or 3D noise respectively.

Examples

1D Noise

2D Animated noise map

Notes

  • The same input coordinates will always produce the same output value

  • Small changes in input produce small changes in output (coherence)

  • For best results, use small increments between coordinates (0.01-0.1)

  • The function is deterministic - same seed produces same sequence

  • Combine with different scales for more complex patterns

Last updated

Was this helpful?