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
Parameters
x
- The x-coordinate in the noise spacey
(optional) - The y-coordinate in the noise spacez
(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 Noise
3D Noise (Animated)
Terrain Generation
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?