perlin noise looping

edited January 6 in Programming Questions

What is the range of unique results for noise(x)? I need to make it loop and transition smoothly.



  • I have no idea what you are asking. But if you want to have noise do smooth, looping values, I suggest this tutorial:

  • edited January 7

    @kellen -- re: "what is the range of unique results for noise(x)"

    Check out the noise() reference page!

    In contrast to the random() function, Perlin noise is defined in an infinite n-dimensional space, in which each pair of coordinates corresponds to a fixed semi-random value (fixed only for the lifespan of the program). The resulting value will always be between 0.0 and 1.0.

    That is the range of possible return values. For your purposes, I think the number of unique inputs that could give unique outputs is best to think of as infinite -- you can just keep increasing a value by very small steps and get non-repeating results.

    Re: "I need to make it loop and transition smoothly."

    Note that "smoothly" for Perlin noise depends on the step size.

    Another way to adjust the character of the resulting sequence is the scale of the input coordinates. As the function works within an infinite space, the value of the coordinates doesn't matter as such; only the distance between successive coordinates is important (such as when using noise() within a loop). As a general rule, the smaller the difference between coordinates, the smoother the resulting noise sequence. Steps of 0.005-0.03 work best for most applications, but this will differ depending on use.

    So, in your loop, get a noise value (0-1), then take a small step (e.g. 0.01) and get another noise value which is similar but drafting in a pseudorandom direction. Repeat, and you get a random walk (although not an unbiased one, if you aggregate the steps rather than updating the position).

Sign In or Register to comment.