JNoise is a simple to use java-library for generating noise (including gradient noise) in Java.
JNoise was created in early 2020 by Articdive. It was created for a project in Minecraft for custom terrain generation. It works for all Java 11+ apps and is built using Gradle.
To add JNoise to your project using Gradle or Maven:
Dependency (Maven):
<dependency>
<groupId>de.articdive</groupId>
<artifactId>jnoise</artifactId>
<version>VERSION</version>
</dependency>
Repository (Gradle Kotlin DSL)
repositories {
mavenCentral()
}
Dependency (Gradle Kotlin DSL)
dependencies {
// JNoise Library
implementation("de.articdive:jnoise:VERSION")
}
The JNoise library supports "Perlin", "OpenSimplex", "Value", "Worley" and "White" noise.
It also supports modules with which you can octavate (fractalize) and combine different noise types.
Every noise-type has different customizable features, e.g. Perlin Noise has different types of interpolation to choose from and Worley Noise's point distribution can be altered.
Normally if you are using an IDE, the code-completition is intuitive enough to use this library without having to check the source-code.
Nevertheless, the Github Wiki contains more than enough information to acquire achieved results.
Example: Creating a noise-generator using Perlin Noise with cosine interpolation.
public JNoise perlinCosine = JNoise.newBuilder().perlin().setInterpolation(InterpolationType.COSINE).setSeed(1729).build();
The Noise's dimension has to do with the amount of parameters. If you add two doubles after the getNoise method, you will receive 2 dimensional noise.
All Noise Implementations support 1D, 2D, 3D and 4D noise.
Example: Getting 2D Perlin-Noise:
public JNoise perlinLinear = JNoise.newBuilder().perlin().setInterpolation(InterpolationType.LINEAR).setSeed(1629).build();
public double getNoise(double x, double y){
// 1D Noise
return perlinLinear.getNoise(x, y);
}
Example: Getting 3D Perlin-Noise:
public JNoise perlinLinear = JNoise.newBuilder().perlin().setInterpolation(InterpolationType.LINEAR).setSeed(1629).build();
public double getNoise(double x, double y, double z){
// 3D Noise
return perlinLinear.getNoise(x, y, z);
}
In this case, the way to get octavated noise values is the exact same. However, we must add a NoiseModule ( the OctavationModule) to our JNoise instance.
Example: Creating a noise-generator using octavated Perlin Noise with cosine interpolation.
public JNoise octavatedPerlin = JNoise.newBuilder().perlin().setInterpolation(InterpolationType.COSINE).addModule(OctavationModule.newBuilder().setOctaves(4).setPersistence(1.0).setLacunarity(1.0).build()).build();
All noise types have a customizable seed.
- Frequency
- Interpolation function
- Fade function
- Frequency
- Distance function
- Feature point amount
- Frequency
- Fast & SuperSimplex algorithms
- Simplex variants
- Frequency
- The underlying noise type to be octavated
- Amount of octaves
- Lacunarity
- Persistance / Gain
- Fractal functions (FBM, Billow & Ridged)
- Seed incrementation per octave (Increases the seed by 1 each octave)
- Addition
- Min/Max
- Multiplication
- Power
@Ken Perlin's work on Perlin Noise.
@Kurt Spencer's work on OpenSimplex2 located here.
@Steven Worley's work on Worley Noise.