Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
rubeea opened this issue Apr 6, 2022 · 3 comments
Open

Comments

@rubeea
Copy link

rubeea commented Apr 6, 2022

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
Copy link
Owner

pvigier commented Apr 6, 2022

Yes, it is!

We will enter only once in the for loop:

noise = np.zeros(shape)
frequency = 1
amplitude = 1
for _ in range(octaves):
noise += amplitude * generate_perlin_noise_2d(
shape, (frequency*res[0], frequency*res[1]), tileable, interpolant
)
frequency *= lacunarity
amplitude *= persistence
return noise

@rubeea
Copy link
Author

rubeea commented Apr 7, 2022

Yes, it is!

We will enter only once in the for loop:

noise = np.zeros(shape)
frequency = 1
amplitude = 1
for _ in range(octaves):
noise += amplitude * generate_perlin_noise_2d(
shape, (frequency*res[0], frequency*res[1]), tileable, interpolant
)
frequency *= lacunarity
amplitude *= persistence
return noise

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
Copy link
Owner

pvigier commented Apr 29, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants