This is based on the previous adapting done by Rune Madsen on rune.noise.js, which was an adaptation from P5.js done by Daniel Shiffman, which was an adaptation from Processing / PApplet.java done by Ben Fry, which was an adaptation from the contributions by Karsten Schmidt aka toxi adapting the code created by the German demo scene group Farbrausch on their demo production "art" ( email@example.com ) adapted from the original work by Ken Perlin. — Props to all of them adaptors!
$ npm install perlin-noise-3d
There are two available files for this module:
dist/perlin-noise-3d.js› CommonJS & ES Module
// ES6// CJSconst perlinNoise3d = ;
Include the minified UMD file for the browser (
dist/perlin-noise-3d.min.js ) or you can add the script directly from unpkg.
Create an instance then you can get
const noise = ;noise;
Plant a seed with
— Example #01 :
linear x and
const noise = ;let noiseStep = 0;forlet x = 0; x < 50; x++let y = noise * 100;console;noiseStep += 01;
— Example #02 : plotting a 2D square graph using a seed
let n = ;n;let size = 10;let output = ;for let x = 0; x < size; x++for let y = 0; y < size; y++output;console;
You can create your instance as follows:
let noise = new perlinNoise3d;
noise.get(x, y, z)
z are the coordinates where you want to get the value. Both second and third parameter are optional.
Set a seed value (
float) to get different noise depending on the noise value.