diff --git a/shader/cloudshader.cpp b/shader/cloudshader.cpp index 4fbb900..778eb91 100644 --- a/shader/cloudshader.cpp +++ b/shader/cloudshader.cpp @@ -44,27 +44,8 @@ Color CloudShader::shade(const Scene &scene, const Ray &ray) const } // Pre-processs accumulated getNoise -// accumulatedNoise /= (float) NOISE_SAMPLES; float cloudDensity = exp(-accumulatedNoise * settings.densityAbsorption); - return background * cloudDensity; - - if (accumulatedNoise < 1 - settings.densityTreshold) - { - accumulatedNoise = 0; - } else - { - // Fade out the getNoise - accumulatedNoise = (accumulatedNoise - (1 - settings.densityTreshold)) / settings.densityTreshold; - } -// return accumulatedNoise * Color(1, 1, 1); - - // Use the getNoise to control the densityTreshold of the clouds - Color cloud = background * (1.0f - accumulatedNoise) + settings.cloudColor * accumulatedNoise; - - // Use the getNoise to add some wispy details to the clouds - cloud += settings.wispyColor * (accumulatedNoise * settings.wispyIntensity); - // Add some ambient and diffuse lighting // cloud += scene.ambientLight() * material.ambient(); // for (const auto &light: scene.lights()) @@ -74,7 +55,8 @@ Color CloudShader::shade(const Scene &scene, const Ray &ray) const // float diffuse = dotProduct(normal, illumination.direction); // cloud += material.cloud() * illumination.cloud * diffuse; // } - return cloud; + + return background * cloudDensity + (1.0f - cloudDensity) * settings.cloudColor; } bool CloudShader::isTransparent() const diff --git a/shader/cloudshader.h b/shader/cloudshader.h index 69b9149..aee7ae8 100644 --- a/shader/cloudshader.h +++ b/shader/cloudshader.h @@ -15,9 +15,7 @@ struct CloudSettings float densityTreshold = 0.55f; float densityIntensity = 2.5f; float densityAbsorption = 1; - Color cloudColor = Color(0.7f, 0.7f, 0.7f); - Color wispyColor = Color(0.9f, 0.9f, 0.9f); - float wispyIntensity = 0.3f; + Color cloudColor = Color(1, 1, 1); }; class CloudShader : public Shader