diff --git a/shader/cloudshader.cpp b/shader/cloudshader.cpp index 5c4379c..5c9ae60 100644 --- a/shader/cloudshader.cpp +++ b/shader/cloudshader.cpp @@ -121,8 +121,13 @@ Color CloudShader::lightMarch(const Scene &scene, Vector3d currentInCloudPositio float transmittance = getDensityTransmittance(density); float scatter = scatterFactor(normalized(lengthDistance), illumination.direction); - float factor = settings.darknessThreshold + - (1.0f - settings.darknessThreshold) * (transmittance * scatter); // (transmittance * scatter) + float factor = transmittance; + if (density > 0) + { + factor = settings.darknessThreshold + + (1.0f - settings.darknessThreshold) * factor * scatter; + } + cloudColor += factor * illumination.color; } diff --git a/shader/cloudshader.h b/shader/cloudshader.h index d00f79c..a7c1cce 100644 --- a/shader/cloudshader.h +++ b/shader/cloudshader.h @@ -17,7 +17,7 @@ struct CloudSettings float scale = 10; float densityOffset = -0.57f; float densityIntensity = 7.0f; // 7.0f - float darknessThreshold = 0.07f; // 0.07f + float darknessThreshold = 0.1f; // 0.07f float shadowIntensity = 0.6f; float shadowLightAbsorption = 1; float lightAbsorptionTowardsLight = 1.0f;