This commit is contained in:
Dan Macbook 2020-08-13 08:10:48 -04:00
parent a4d1b5b972
commit 991aaa8677
4 changed files with 80 additions and 5 deletions

View File

@ -21,8 +21,9 @@ public class NoiseView extends JPanel {
private static final long serialVersionUID = 2094606939770332040L;
RollingSequence r = new RollingSequence(256);
CNG cng = NoiseStyle.PERLIN_IRIS.create(new RNG(RNG.r.nextLong())).scale(0.25);
RollingSequence r = new RollingSequence(60);
boolean colorMode = true;
CNG cng = NoiseStyle.SIMPLEX.create(new RNG(RNG.r.nextLong())).scale(0.25);
GroupedExecutor gx = new GroupedExecutor(Runtime.getRuntime().availableProcessors(), Thread.MAX_PRIORITY,
"Iris Renderer");
ReentrantLock l = new ReentrantLock();
@ -66,8 +67,9 @@ public class NoiseView extends JPanel {
break;
}
Color color = Color.getHSBColor((float) (n), 1f - (float) (n * n * n * n * n * n),
1f - (float) n);
Color color = colorMode
? Color.getHSBColor((float) (n), 1f - (float) (n * n * n * n * n * n), 1f - (float) n)
: Color.getHSBColor(0f, 0f, (float) n);
int rgb = color.getRGB();
co[xx][z] = rgb;
}
@ -98,7 +100,7 @@ public class NoiseView extends JPanel {
frame.add(new NoiseView());
frame.setLocationByPlatform(true);
frame.pack();
frame.setSize(900, 500);
frame.setSize(1440, 820);
frame.setVisible(true);
}

View File

@ -0,0 +1,38 @@
package com.volmit.iris.noise;
import com.volmit.iris.noise.FastNoise.FractalType;
import com.volmit.iris.util.RNG;
public class FractalBillowPerlinNoise implements NoiseGenerator, OctaveNoise {
private final FastNoise n;
public FractalBillowPerlinNoise(long seed) {
this.n = new FastNoise(new RNG(seed).imax());
n.SetFractalOctaves(1);
n.SetFractalType(FractalType.Billow);
}
public double f(double v) {
return (v / 2D) + 0.5D;
}
@Override
public double noise(double x) {
return f(n.GetPerlinFractal((float) x, 0f));
}
@Override
public double noise(double x, double z) {
return f(n.GetPerlinFractal((float) x, (float) z));
}
@Override
public double noise(double x, double y, double z) {
return f(n.GetPerlinFractal((float) x, (float) y, (float) z));
}
@Override
public void setOctaves(int o) {
n.SetFractalOctaves(o);
}
}

View File

@ -5,6 +5,7 @@ public enum NoiseType {
SIMPLEX(seed -> new SimplexNoise(seed)),
PERLIN(seed -> new PerlinNoise(seed)),
FRACTAL_BILLOW_SIMPLEX(seed -> new FractalBillowSimplexNoise(seed)),
FRACTAL_BILLOW_PERLIN(seed -> new FractalBillowPerlinNoise(seed)),
FRACTAL_FBM_SIMPLEX(seed -> new FractalFBMSimplexNoise(seed)),
FRACTAL_RIGID_MULTI_SIMPLEX(seed -> new FractalRigidMultiSimplexNoise(seed)),
CELLULAR(seed -> new CellularNoise(seed)),

View File

@ -42,6 +42,32 @@ public enum NoiseStyle {
@DontObfuscate
SIMPLEX(rng -> new CNG(rng, 1D, 1).scale(1)),
@Desc("Very Detailed smoke using simplex fractured with fractal billow simplex at high octaves.")
@DontObfuscate
FRACTAL_SMOKE(rng -> new CNG(rng, 1D, 1)
.fractureWith(new CNG(rng.nextParallelRNG(1), NoiseType.FRACTAL_BILLOW_SIMPLEX, 1D, 8).scale(0.2), 1000)
.scale(0.34)),
@Desc("Thinner Veins.")
@DontObfuscate
VASCULAR_THIN(rng -> new CNG(rng.nextParallelRNG(1), NoiseType.VASCULAR, 1D, 1).scale(1).pow(0.65)),
@Desc("Cells of simplex noise")
@DontObfuscate
SIMPLEX_CELLS(rng -> new CNG(rng.nextParallelRNG(1), NoiseType.SIMPLEX, 1D, 1).scale(1)
.fractureWith(new CNG(rng.nextParallelRNG(8), NoiseType.CELLULAR, 1D, 1).scale(1), 200)),
@Desc("Veins of simplex noise")
@DontObfuscate
SIMPLEX_VASCULAR(rng -> new CNG(rng.nextParallelRNG(1), NoiseType.SIMPLEX, 1D, 1).scale(1)
.fractureWith(new CNG(rng.nextParallelRNG(8), NoiseType.VASCULAR, 1D, 1).scale(1), 200)),
@Desc("Very Detailed fluid using simplex fractured with fractal billow simplex at high octaves.")
@DontObfuscate
FRACTAL_WATER(rng -> new CNG(rng, 1D, 1)
.fractureWith(new CNG(rng.nextParallelRNG(1), NoiseType.FRACTAL_FBM_SIMPLEX, 1D, 9).scale(0.03), 9900)
.scale(1.14)),
@Desc("Perlin. Like simplex but more natural")
@DontObfuscate
PERLIN(rng -> new CNG(rng, NoiseType.PERLIN, 1D, 1).scale(1.47)),
@ -62,6 +88,14 @@ public enum NoiseStyle {
@DontObfuscate
PERLIN_IRIS_THICK(rng -> CNG.signatureThick(rng, NoiseType.PERLIN).scale(1.47)),
@Desc("Billow Fractal Perlin Noise.")
@DontObfuscate
FRACTAL_BILLOW_PERLIN(rng -> new CNG(rng, NoiseType.FRACTAL_BILLOW_PERLIN, 1D, 1).scale(1.47)),
@Desc("Billow Fractal Perlin Noise. 2 Octaves")
@DontObfuscate
BIOCTAVE_FRACTAL_BILLOW_PERLIN(rng -> new CNG(rng, NoiseType.FRACTAL_BILLOW_PERLIN, 1D, 2).scale(1.17)),
@Desc("Billow Fractal Simplex Noise. Single octave.")
@DontObfuscate
FRACTAL_BILLOW_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX, 1D, 1)),