SIMDNoise
Super fast SIMD noise library for Rust. PRs welcome!
Features
- Gradient Noise (Simplex aka Perlin) 1D,2D,3D,4D
- Fractal Brownian Motion, Ridge, and Turbulence
- Cellular Noise (aka Voroni) 2D, 3D
- SSE2, SSE41, and AVX2 instruction sets, along with non SIMD fallback
- AVX2 version also leverages FMA3
- Runtime detection picks the best available instruction set
- Provide a seed value to randomize your noise result
Benchmarks
Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz Single Threaded using Criterion.rs
2D 4k (3840 × 2160) Fbm Noise, 3 Octaves
SIMD Set | Time |
---|---|
scalar | 888 ms |
sse2 | 225 ms |
sse41 | 186 ms |
avx2 | 108 ms |
3D 128 × 128 x 128 Cell Noise
SIMD Set | Time |
---|---|
scalar | 1,400 ms |
sse2 | 128 ms |
sse41 | 94 ms |
avx2 | 47 ms |
Todo
- AVX512 support
- ARM NEON support
- Other noise types
Get a block of noise with runtime SIMD detection
The library will, at runtime, pick the fastest available options between SSE2, SSE41, and AVX2.
// Get a block of 2d fbm noise with default settings, 100 x 100, with values scaled to the range [0,1]
let noise = fbm_2d.generate_scaled;
// Get a block of 3d ridge noise, custom settings, 32x32x32 unscaled
let = ridge_3d
.with_freq
.with_octaves
.with_gain
.with_seed
.with_lacunarity
.generate;
Call noise functions directly
Sometimes you need something other than a block, like the points on the surface of a sphere. Sometimes you may want to use SSE41 even with AVX2 is available.
let noise_setting = ridge_3d
.with_freq
.with_octaves
.with_gain
.with_lacunarity
.wrap;
// get a block of noise with the sse41 version, using the above settings
let = unsafe ;
// send your own SIMD x,y values to the noise functions directly
unsafe ;