
Show HN: A SIMD-accelerated noise library in Rust - gameswithgo
https://github.com/jackmott/rust-simd-noise
======
yoklov
> Sometimes you may want to use SSE41 even with AVX2 is available.

I'm glad this is an option. I feel like a lot of libraries assume you always
want the widest SIMD width possible, when this is very likely to cause
performance issues for many cases.

~~~
gameswithgo
exactly!

------
virtualritz
Very nice! Any plans to extend it to support more noise types and 1D and 4D
variants? This may serve for inspiration:
[https://github.com/Auburns/FastNoiseSIMD](https://github.com/Auburns/FastNoiseSIMD)

~~~
gameswithgo
The author of that is a good friend! I was showing him my SIMD C++ noise
library and that inspired him to make that (which is much much better than the
thing I had hacked together in c++)

Doing SIMD accelerated 1D noise is probably pointless, as it will be so fast.
I could add scalar versions of 1d though.

I'm up for 4D potentially if anyone has some use cases.

~~~
virtualritz
4D ist commonly utilized for any 3D use case that needs to vary over time.
Likewise, 3D noise is also used for 2D that needs to vary over time.

~~~
gameswithgo
Yeah I understand that being the stated reason I've just not seen it actually
done very often as the performance/memory use is an issue. I've been surveying
some people though and a couple people are actually using it, looks like!

------
obl
Any reason to stick with the horrible intel intrinsic C API ?

TBH I find assembly kernels generally more readable as long as one keep a few
comments in there to explicit register allocation.

~~~
pornel
Rust chose to adopt the vendors' naming schemes exactly as they were defined,
instead of inventing their own. The idea was that these intrinsics are
official, well-understood and people will build higher-level abstractions on
top of them anyway.

~~~
kibwen
To elaborate a bit, the intention is to first stabilize the platform-dependent
low-level intrinsics just as specified by each vendor, under the "arch"
namespace in the standard library (e.g. `use std::arch::x86_64::whatever`,
which is quite self-explanatorily nonportable). This will hit stable Rust as
of the next release, on June 21. Future work will focus on building a more
portable, more Rust-like, higher-level API on top of these intrinsics under
the "simd" namespace in the standard library; you can see the current state of
this work at [https://rust-lang-
nursery.github.io/stdsimd/x86_64/stdsimd/s...](https://rust-lang-
nursery.github.io/stdsimd/x86_64/stdsimd/simd/index.html) .

------
eismcc
What common use cases does this have? Not sure when I’d ever use it.

~~~
gameswithgo
Generating textures and geometry in games and art tools are the most common
applications.

Some examples:

[http://libnoise.sourceforge.net/examples/complexplanet/index...](http://libnoise.sourceforge.net/examples/complexplanet/index.html)

~~~
Cthulhu_
That's not what 'noise' looks like to me, or well, it's not the white noise
I'd associate with TV, more like err, a semirandom generated height map of
sorts. Still, that amount of detail requires billions of datapoints,
generating those quickly is beneficial. I can imagine games like Elite:
Dangerous and No Man's Sky use those a lot for the trillions of planets they
have.

~~~
gameswithgo
These are all examples of "Gradient Noise" which is intended to produce
naturally varying types of noise.

There is also value noise, white noise (what you are thinking of), cellular
noise. It is an interesting field!

value noise and white noise are computationally easy enough that it probably
doesn't make sense to simdify them. probably!

