Proper white color for clouds
This commit is contained in:
parent
0eef1f8e6e
commit
66959c3599
2 changed files with 3 additions and 23 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue