From 0eef1f8e6eb1ab40efb697d4788d3ce53bf541ef Mon Sep 17 00:00:00 2001 From: Maximilian Giller Date: Tue, 24 Jan 2023 08:35:10 +0100 Subject: [PATCH] Cloud noise adjustments --- common/noise/cloudnoise.cpp | 6 ++++-- fancy1.cpp | 6 +++--- shader/cloudshader.h | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/common/noise/cloudnoise.cpp b/common/noise/cloudnoise.cpp index 58b5972..872efde 100644 --- a/common/noise/cloudnoise.cpp +++ b/common/noise/cloudnoise.cpp @@ -9,7 +9,8 @@ CloudNoise::CloudNoise(int size) : Noise(size) WorleyNoise worleyNoise3(size, 8); // Some perlin noises - PerlinNoise perlinNoise1(size, 15); + PerlinNoise perlinNoise1(size, 3); + PerlinNoise perlinNoise2(size, 15); // Generate the noise for (int x = 0; x < size; x++) @@ -26,8 +27,9 @@ CloudNoise::CloudNoise(int size) : Noise(size) float worley3 = worleyNoise3.getNoise(sx, sy, sz); float perlin1 = perlinNoise1.getNoise(sx, sy, sz); + float perlin2 = perlinNoise2.getNoise(sx, sy, sz); - float noise = worley1 * 0.6f + worley3 * 0.2f + perlin1 * 0.2; + float noise = worley1 * 0.4f + worley3 * 0.12f + perlin1 * 0.36f + perlin2 * 0.12; setNoise(x, y, z, noise); } diff --git a/fancy1.cpp b/fancy1.cpp index 8dc7c30..efab8bb 100644 --- a/fancy1.cpp +++ b/fancy1.cpp @@ -44,11 +44,11 @@ int main() // Add box for volume shader auto cloudSettings = CloudSettings(); - cloudSettings.scale = 5.0f; - cloudSettings.densityIntensity = 2.0f; + cloudSettings.scale = 10.0f; + cloudSettings.densityIntensity = 3.0f; cloudSettings.densityTreshold = 0.55f; auto cloudShader = std::make_shared(cloudSettings); - scene.add(std::make_shared(Vector3d(5.0f, 6.0f, 5.0f), Vector3d(6.0f, 4.0f, 6.0f), cloudShader)); + scene.add(std::make_shared(Vector3d(5.0f, 6.0f, 5.0f), Vector3d(50.0f, 4.0f, 50.0f), cloudShader)); // build the tree scene.buildTree(); diff --git a/shader/cloudshader.h b/shader/cloudshader.h index fbbbc39..69b9149 100644 --- a/shader/cloudshader.h +++ b/shader/cloudshader.h @@ -11,7 +11,7 @@ int const NOISE_SIZE = 128; struct CloudSettings { int densitySamples = 100; - float scale = 1; + float scale = 10; float densityTreshold = 0.55f; float densityIntensity = 2.5f; float densityAbsorption = 1;