An edit of FastNoise_Java by Auburns, improving GWT behavior and adding features.
This is a single-file library, pretty much, for generating various kinds of continuous noise, such as Perlin and Simplex noise. There are separate tests and visualizers used to ensure the noise is doing what it should, but if you want to use this library you really only need to copy Noise.java into your own codebase. If you want to be able to update more easily and don't need to edit this code, you can use a JAR from the Releases tab, or get this as a Maven or Gradle dependency from Maven Central:
For Maven,
<dependency>
<groupId>com.github.tommyettinger</groupId>
<artifactId>make_some_noise</artifactId>
<version>0.2</version>
</dependency>
or for Gradle,
implementation "com.github.tommyettinger:make_some_noise:0.2"
(You may need to change implementation
to api
or the older compile
for some projects.)
Lots of noise stuff! You can construct a Noise object with some initial configuration (it
can all be changed later), like the seed, frequency, noise type (the default is
SIMPLEX_FRACTAL
), and how many octaves to use for fractal noise types.
You can do the standard layering of different octaves of noise using the "_FRACTAL" noise
types, like SIMPLEX_FRACTAL
, PERLIN_FRACTAL
, or FOAM_FRACTAL
, by specifying more than
one octave and possibly setting the fractal type with noise.setFractalType(Noise.FBM)
.
You can use other fractal types, such as BILLOW
(which produces more high values with
lines of very dark values) and RIDGED_MULTI
(which produces mostly low values with fiery
streaks of high values); these often look quite different as octaves are added! You can
adjust the "lacunarity" and "gain" when using multiple octaves; these affect how much the
frequency changes between octaves and how much the contribution changes, respectively. Noise
this produces is supposed to always be between -1.0 and 1.0; some bugs are entirely likely
when fiddling with lacunarity and gain on some fractal types (especially BILLOW
), but as
long as lacunarity and gain are their default values, all of the noise types and fractal
types should stay in that range.
All are 2D.
- VALUE:
- VALUE_FRACTAL:
- PERLIN:
- PERLIN_FRACTAL:
- SIMPLEX:
- SIMPLEX_FRACTAL:
- CELLULAR:
- WHITE_NOISE:
- CUBIC:
- CUBIC_FRACTAL:
- FOAM:
- FOAM_FRACTAL:
All are 2D.