Razaekel / noise-rs

Procedural noise generation library for Rust.
Apache License 2.0
842 stars 118 forks source link

Fbm returns value outside of [-1, 1] #329

Closed Laocoon7 closed 1 year ago

Laocoon7 commented 1 year ago

fbm.rs#181 state // Scale the result into the [-1,1] range

let noise_gen = noise::Fbm::<noise::Perlin>::new(0);
let x = 29.0 * 0.03 + 0.6;
let y = 2.0 * 0.03 + 0.6;
let result = noise::NoiseFn::get(&noise_gen, [x, y]);
panic!("{}", result);

I would assume result should be between [-1, 1] from the comment, and most noise libraries generating normalized outputs, however the value I receive is 1.0948304546272307

manankarnik commented 1 year ago

I looked at it and it has been fixed in commit https://github.com/Razaekel/noise-rs/commit/85e478652d911595eb4066fc3fce7aa103b8ada8, however it is not released yet.

Razaekel commented 1 year ago

Seconding what @manankarnik says.