simplex-noise

A fast, dependency-free simplex noise implementation for JavaScript and TypeScript

Library
npm
v4.0.3
1,846stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
44/100Fair
Development Activity0
Maintenance20
Community56
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
70/100Good
Architecture65
Code Quality78
Innovation60
Learning Curve75

simplex-noise is a small, self-contained port of Ken Perlin’s simplex noise algorithm (via Stefan Gustavson and Peter Eastman’s reference implementation) to JavaScript and TypeScript. It exposes tree-shakeable createNoise2D/createNoise3D/createNoise4D factory functions that each return a pure noise function, runs in both the browser and Node.js via CommonJS or ES Modules, and benchmarks at tens of millions of calls per second on a single thread. Because it’s dependency-free and about 2KB minified and gzipped, it’s a common building block for procedural generation, generative art, and terrain/texture synthesis.

What You Get

  • createNoise2D, createNoise3D, and createNoise4D factory functions, each returning a fast noise-sampling function
  • Optional custom PRNG seeding (e.g. via the companion alea package) for reproducible noise fields
  • Tree-shakeable ES Module and CommonJS builds with full TypeScript type definitions
  • A dependency-free, ~2KB minified+gzipped bundle with 100% test coverage and snapshot-tested output

Common Use Cases

  • Generating procedural terrain, textures, or voxel worlds in games and 3D graphics
  • Driving generative art, plasma effects, and shader-like visual effects on canvas or WebGL
  • Producing organic-looking film grain or noise overlays in image/video processing pipelines
  • Creating reproducible, seeded noise fields for procedural generation that need deterministic output

Under The Hood

Architecture - The entire library lives in a single file, simplex-noise.ts, which precomputes gradient tables (grad2/grad3/grad4 as Float64Arrays) and skew/unskew constants (F2/G2 through F4/G4) at module load time, then exposes createNoise2D/createNoise3D/createNoise4D factory functions that close over a permutation table built once per call and return a small, allocation-free noise-sampling function optimized with a fastFloor integer-coercion trick for speed. Tech Stack - Written in TypeScript with no runtime dependencies, built via a custom build.sh into separate CommonJS and ESM outputs (tsconfig-commonjs.json/tsconfig-esm.json), linted with a legacy .eslintrc.js, and tested with Mocha (.mocharc.json) plus snapshot-based visual regression tests that render PNGs into snapshots/ for 2D/3D/4D noise and the permutation table. Code Quality - test/simplex-noise-test.ts and test/matches-snapshot.ts exercise correctness and byte-for-byte snapshot stability across versions, the README states 100% test coverage as of the 4.x rewrite, and a perf/ directory benchmarks throughput; naming favors terse math-domain identifiers (F2, G3, fastFloor) typical of performance-critical numeric code rather than descriptive names, which is a common readability trade-off in this kind of library. API Design - The factory-function design (createNoise2D() returning a plain function) is deliberately minimal and tree-shakeable, replacing the older 3.x class-based new SimplexNoise() API; the README documents a clear 3.x-to-4.x migration path and seeding via an injectable PRNG, keeping the public surface small while still supporting reproducible output.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search