From 991aaa86778fc208ef8a793e11c07b938cec3bbd Mon Sep 17 00:00:00 2001 From: Dan Macbook Date: Thu, 13 Aug 2020 08:10:48 -0400 Subject: [PATCH] MOAR --- src/main/java/com/volmit/iris/NoiseView.java | 12 +++--- .../iris/noise/FractalBillowPerlinNoise.java | 38 +++++++++++++++++++ .../java/com/volmit/iris/noise/NoiseType.java | 1 + .../com/volmit/iris/object/NoiseStyle.java | 34 +++++++++++++++++ 4 files changed, 80 insertions(+), 5 deletions(-) create mode 100644 src/main/java/com/volmit/iris/noise/FractalBillowPerlinNoise.java diff --git a/src/main/java/com/volmit/iris/NoiseView.java b/src/main/java/com/volmit/iris/NoiseView.java index 881ef6f19..df74e0494 100644 --- a/src/main/java/com/volmit/iris/NoiseView.java +++ b/src/main/java/com/volmit/iris/NoiseView.java @@ -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); } diff --git a/src/main/java/com/volmit/iris/noise/FractalBillowPerlinNoise.java b/src/main/java/com/volmit/iris/noise/FractalBillowPerlinNoise.java new file mode 100644 index 000000000..3a8d836d3 --- /dev/null +++ b/src/main/java/com/volmit/iris/noise/FractalBillowPerlinNoise.java @@ -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); + } +} diff --git a/src/main/java/com/volmit/iris/noise/NoiseType.java b/src/main/java/com/volmit/iris/noise/NoiseType.java index fdd4f8a27..6386fa36d 100644 --- a/src/main/java/com/volmit/iris/noise/NoiseType.java +++ b/src/main/java/com/volmit/iris/noise/NoiseType.java @@ -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)), diff --git a/src/main/java/com/volmit/iris/object/NoiseStyle.java b/src/main/java/com/volmit/iris/object/NoiseStyle.java index 0ca0ba7e6..7fa70e538 100644 --- a/src/main/java/com/volmit/iris/object/NoiseStyle.java +++ b/src/main/java/com/volmit/iris/object/NoiseStyle.java @@ -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)),