public class ClassicNoise extends java.lang.Object implements Noise.Noise2D, Noise.Noise3D, Noise.Noise4D, Noise.Noise5D, Noise.Noise6D
SeededNoise
; both can be produced by FastNoise
).
This noise can in theory be scaled up to arbitrary dimensions, but in practice uses unreasonably hefty amounts of
memory when dimensionality exceeds 10 or so, since it needs to hash Math.pow(2, dimensionality)
points per
sample of noise, which involves over a thousand points in 10 dimensions and over a million points in 20 dimensions.
For that reason, it's limited to 6D noise here, and also implements 2D, 3D, and 4D. Its performance is surprisingly
good at 2D, 3D, and 4D but trails off quickly at 6D. Its quality is worse than normal simplex noise in 2D, but you
can use JitterNoise
(which takes the same algorithm and distorts the grid pseudo-randomly) to get unusually
high-quality 2D noise. The quality is actually quite good in 4D and higher; there's often some rhythmic patterns in
3D when time is z, but with 4 or 6 dimensions this can have fewer artifacts than Simplex in the same dimension. The
3D and higher dimensionality versions don't seem to need jitter to avoid grid artifacts, at least most of the time.
This uses different gradient vectors than what was recommended in the "Improved Perlin Noise" paper, since the ones
this uses avoid 45-degree angular artifacts in all dimensions implemented.
WorldMapGenerator
that need a
Noise3D implementation, and it tends to about as fast as SeededNoise
in 3D. It is not recommended for 2D
use; prefer JitterNoise
or SeededNoise
for that. You can also use FastNoise
with
FastNoise.PERLIN_FRACTAL
as the noiseType if you primarily want to use float input and get float output.
If you want higher-dimensional noise than this supports, you can use PhantomNoise
.Modifier and Type | Field and Description |
---|---|
static ClassicNoise |
instance |
long |
seed |
Constructor and Description |
---|
ClassicNoise() |
ClassicNoise(long seed) |
Modifier and Type | Method and Description |
---|---|
double |
getNoise(double x,
double y) |
double |
getNoise(double x,
double y,
double z) |
double |
getNoise(double x,
double y,
double z,
double w) |
double |
getNoise(double x,
double y,
double z,
double w,
double u) |
double |
getNoise(double x,
double y,
double z,
double w,
double u,
double v) |
double |
getNoiseWithSeed(double x,
double y,
double z,
double w,
double u,
double v,
long seed) |
double |
getNoiseWithSeed(double x,
double y,
double z,
double w,
double u,
long seed) |
double |
getNoiseWithSeed(double x,
double y,
double z,
double w,
long seed) |
double |
getNoiseWithSeed(double x,
double y,
double z,
long seed) |
double |
getNoiseWithSeed(double x,
double y,
long seed) |
protected static double |
gradCoord2D(long seed,
int x,
int y,
double xd,
double yd) |
protected static double |
gradCoord3D(long seed,
int x,
int y,
int z,
double xd,
double yd,
double zd) |
protected static double |
gradCoord4D(long seed,
int x,
int y,
int z,
int w,
double xd,
double yd,
double zd,
double wd) |
protected static double |
gradCoord5D(long seed,
int x,
int y,
int z,
int w,
int u,
double xd,
double yd,
double zd,
double wd,
double ud) |
protected static double |
gradCoord6D(long seed,
int x,
int y,
int z,
int w,
int u,
int v,
double xd,
double yd,
double zd,
double wd,
double ud,
double vd) |
public static final ClassicNoise instance
public long seed
protected static double gradCoord2D(long seed, int x, int y, double xd, double yd)
protected static double gradCoord3D(long seed, int x, int y, int z, double xd, double yd, double zd)
protected static double gradCoord4D(long seed, int x, int y, int z, int w, double xd, double yd, double zd, double wd)
protected static double gradCoord5D(long seed, int x, int y, int z, int w, int u, double xd, double yd, double zd, double wd, double ud)
protected static double gradCoord6D(long seed, int x, int y, int z, int w, int u, int v, double xd, double yd, double zd, double wd, double ud, double vd)
public double getNoise(double x, double y)
getNoise
in interface Noise.Noise2D
public double getNoiseWithSeed(double x, double y, long seed)
getNoiseWithSeed
in interface Noise.Noise2D
public double getNoise(double x, double y, double z)
getNoise
in interface Noise.Noise3D
public double getNoiseWithSeed(double x, double y, double z, long seed)
getNoiseWithSeed
in interface Noise.Noise3D
public double getNoise(double x, double y, double z, double w)
getNoise
in interface Noise.Noise4D
public double getNoiseWithSeed(double x, double y, double z, double w, long seed)
getNoiseWithSeed
in interface Noise.Noise4D
public double getNoise(double x, double y, double z, double w, double u)
getNoise
in interface Noise.Noise5D
public double getNoiseWithSeed(double x, double y, double z, double w, double u, long seed)
getNoiseWithSeed
in interface Noise.Noise5D
public double getNoise(double x, double y, double z, double w, double u, double v)
getNoise
in interface Noise.Noise6D
public double getNoiseWithSeed(double x, double y, double z, double w, double u, double v, long seed)
getNoiseWithSeed
in interface Noise.Noise6D
Copyright © Eben Howard 2012–2022. All rights reserved.