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

Fractal noise scaling #333

Open
gwafotapa opened this issue Feb 2, 2023 · 0 comments
Open

Fractal noise scaling #333

gwafotapa opened this issue Feb 2, 2023 · 0 comments

Comments

@gwafotapa
Copy link

When computing a fractal noise, the sum of all octaves is normalized by dividing it by the sum of the amplitudes of the octaves. Here's the code of the function which computes the normalizing factor amp_fractal:

    fn calculate_fractal_bounding(&mut self) {
        let mut amp: f32 = self.gain;
        let mut amp_fractal: f32 = 1.0;
        for _ in 0..self.octaves {
            amp_fractal += amp;
            amp *= self.gain;
        }
        self.fractal_bounding = 1.0 / amp_fractal;
    }

The computed sum amp_fractal has one more term than the number of octaves. I believe this is wrong. For example, in the particular case where you have one octave only, it ends up rescaling the noise by dividing it by (1 + gain) as if we had two octaves when it should divide by 1 instead (i.e. no normalization needed since there's only one octave). This can be confirmed by looking at Auburn's original code.

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

1 participant