octaveNoise(x, y, z, octaves, persistence)

The octaveNoise() function generates fractal Perlin noise by combining multiple layers (octaves) of noise at different frequencies and amplitudes. This creates more complex and natural-looking patterns than basic Perlin noise.

Syntax

octaveNoise(x, y, z, octaves, persistence)

Parameters

  • x - The x-coordinate in the noise space

  • y - The y-coordinate in the noise space

  • z - The z-coordinate in the noise space

  • octaves - The number of layers of noise to combine

  • persistence - How much each octave contributes to the final result (0-1)

Return Value

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

Description

Octave noise (also known as fractal noise) combines multiple layers of Perlin noise to create more detailed and natural-looking patterns. Each octave:

  1. Has double the frequency (more detail) of the previous octave

  2. Has its amplitude reduced by the persistence factor

This creates noise with both large-scale features and fine details, similar to natural phenomena like terrain, clouds, or textures.

The parameters work as follows:

  • Higher octaves values create more detailed noise but are more computationally expensive

  • Lower persistence values create smoother noise with subtle details

  • Higher persistence values create rougher noise with more prominent details

Examples

Basic Octave Noise

Terrain Generation with Octave Noise

2D Noise Map with Different Parameters

Comparison with Basic Noise

Octave noise differs from basic Perlin noise in several ways:

  1. Detail level: Octave noise contains both large features and fine details

  2. Complexity: Octave noise creates more complex, natural-looking patterns

  3. Control: The octaves and persistence parameters allow fine-tuning of the noise characteristics

  4. Performance: Octave noise is more computationally expensive due to calculating multiple layers

Notes

  • Typical values for octaves range from 1 to 8 (higher values are more expensive)

  • Typical values for persistence range from 0.25 to 0.75

  • Each additional octave doubles the computational cost

  • For real-time applications, use fewer octaves (1-4)

  • For pre-generated content, higher octave counts (4-8) create more detailed results

Last updated

Was this helpful?