From 9b228bff61f592760f9e1442afd898e255dd0a0c Mon Sep 17 00:00:00 2001 From: Maximilian Giller Date: Fri, 27 Jan 2023 05:36:27 +0100 Subject: [PATCH] SOme adjustments --- shader/cloudshader.cpp | 9 +++++++-- shader/cloudshader.h | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) 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;