joshforisha / fast-simplex-noise-js

Fast simplex noise implemented in TypeScript
The Unlicense
66 stars 7 forks source link

Spherical noise out of range #9

Closed makryl closed 3 years ago

makryl commented 7 years ago

Hello! Thank you for great library!

I'v noticed that spherical noise sometimes goes out of range.

Run this code, and you will see some values out of range -1;1

var noise = new FastSimplexNoise();
var size = 20;

for (var y = 0; y < size; y++) {
    for (var x = 0; x < size; x++) {
        var value = noise.spherical2D(size, x, y);
        if (value < -1 || value > 1) {
            console.log(value);
        }
    }
}
joshforisha commented 7 years ago

Well that's not great!

Unfortunately, I'm not maintaining fast-simplex-noise-js anymore. I've instead moved over to work on open-simplex-noise-js and fractal-noise-js, which essentially split up the functionality of this library, and add some improvements.

Having said that, I'll gladly accept pull requests here for a fix. I would just rather concentrate on the more recent libraries.

makryl commented 7 years ago

Thanks for answer! I will switch to these libraries and check if they have same bug :)

makryl commented 7 years ago

Just checked new libraries, and looks that there is no bug

var size = 200;
var noise = new OpenSimplexNoise(Date.now());
var field = FractalNoise.makeSphereSurface(size, (x, y, z) => noise.noise3D(x, y, z));

for (var y = 0; y < size; y++) {
    for (var x = 0; x < size; x++) {
        var value = field[x][y];
        if (value < -1 || value > 1) {
            console.log(value);
        }
    }
}

All values in range. Thanx!