pvigier / perlin-numpy

A fast and simple perlin noise generator using numpy
https://pvigier.github.io/2018/06/13/perlin-noise-numpy.html
MIT License
304 stars 50 forks source link

Question regarding the number of octaves in fractal noise generator #12

Open rubeea opened 2 years ago

rubeea commented 2 years ago

Hi,

As per the documentation of generate_fractal_noise_2d function, the third argument is the number of octaves in the noise. If the number of octaves is 1, will this function generate the perlin noise since the fractal noise is nothing but multiple octaves of perlin noise combined. So, when the octave is 1 is the perlin noise generated?

Thanks in advance

pvigier commented 2 years ago

Yes, it is!

We will enter only once in the for loop: https://github.com/pvigier/perlin-numpy/blob/6f077f811f5708e504732c26dee8f2015b95da0c/perlin_numpy/perlin2d.py#L87-L96

rubeea commented 2 years ago

Yes, it is!

We will enter only once in the for loop:

https://github.com/pvigier/perlin-numpy/blob/6f077f811f5708e504732c26dee8f2015b95da0c/perlin_numpy/perlin2d.py#L87-L96

Hi, Noted with thanks. I have one more question regarding other parameters (lacunarity and persistence) in the fractal noise generator. I want to generate fractal noise of shape (256,256,3) and for that I wrote the following code snippet: noise = generate_fractal_noise_3d( (256, 256, 3), (4, 4, 1), octaves=4, lacunarity=1, tileable=(True, False, False) ) The default lacunarity in your code is 2 but with lacunarity=2 the output shape of (256,256,3) is not possible as shape must be a multiple of (lacunarity*(octaves-1)res) for 3D fractal noise. Is there any other configuration via which I can achieve an out shape of (256,256,3) using a lacunarity>1? And if I use lacunarity=1 is that a valid config for the fractal noise?

Thanks in advance :)

pvigier commented 2 years ago

Sorry for the delay.

You can generate more, for instance (256, 256, 8) with lacunarity=2 if I am not mistaken, and then keep only what you need.