Cloud noise adjustments

This commit is contained in:
Maximilian Giller 2023-01-24 08:35:10 +01:00
parent a90441c255
commit 0eef1f8e6e
3 changed files with 8 additions and 6 deletions

View file

@ -9,7 +9,8 @@ CloudNoise::CloudNoise(int size) : Noise(size)
WorleyNoise worleyNoise3(size, 8); WorleyNoise worleyNoise3(size, 8);
// Some perlin noises // Some perlin noises
PerlinNoise perlinNoise1(size, 15); PerlinNoise perlinNoise1(size, 3);
PerlinNoise perlinNoise2(size, 15);
// Generate the noise // Generate the noise
for (int x = 0; x < size; x++) 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 worley3 = worleyNoise3.getNoise(sx, sy, sz);
float perlin1 = perlinNoise1.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); setNoise(x, y, z, noise);
} }

View file

@ -44,11 +44,11 @@ int main()
// Add box for volume shader // Add box for volume shader
auto cloudSettings = CloudSettings(); auto cloudSettings = CloudSettings();
cloudSettings.scale = 5.0f; cloudSettings.scale = 10.0f;
cloudSettings.densityIntensity = 2.0f; cloudSettings.densityIntensity = 3.0f;
cloudSettings.densityTreshold = 0.55f; cloudSettings.densityTreshold = 0.55f;
auto cloudShader = std::make_shared<CloudShader>(cloudSettings); auto cloudShader = std::make_shared<CloudShader>(cloudSettings);
scene.add(std::make_shared<Box>(Vector3d(5.0f, 6.0f, 5.0f), Vector3d(6.0f, 4.0f, 6.0f), cloudShader)); scene.add(std::make_shared<Box>(Vector3d(5.0f, 6.0f, 5.0f), Vector3d(50.0f, 4.0f, 50.0f), cloudShader));
// build the tree // build the tree
scene.buildTree(); scene.buildTree();

View file

@ -11,7 +11,7 @@ int const NOISE_SIZE = 128;
struct CloudSettings struct CloudSettings
{ {
int densitySamples = 100; int densitySamples = 100;
float scale = 1; float scale = 10;
float densityTreshold = 0.55f; float densityTreshold = 0.55f;
float densityIntensity = 2.5f; float densityIntensity = 2.5f;
float densityAbsorption = 1; float densityAbsorption = 1;