Reset some values and a somewhat decent result

This commit is contained in:
Maximilian Giller 2023-01-27 05:27:42 +01:00
parent 79446c289b
commit 81e9a162be
2 changed files with 5 additions and 3 deletions

View file

@ -55,6 +55,9 @@ Color CloudShader::shade(const Scene &scene, const Ray &ray) const
accumulatedDensity += sampleDensity;
}
if (accumulatedDensity > 1)
cloudColor /= accumulatedDensity;
float transmittance = exp(-accumulatedDensity * settings.lightAbsorptionThroughCloud);
return background * transmittance + cloudColor;
@ -118,9 +121,8 @@ Color CloudShader::lightMarch(const Scene &scene, Vector3d currentInCloudPositio
float transmittance = getDensityTransmittance(density);
float scatter = scatterFactor(normalized(lengthDistance), illumination.direction);
// TODO: Back to default
float factor = settings.darknessThreshold +
(1.0f - settings.darknessThreshold) * (1); // (transmittance * scatter)
(1.0f - settings.darknessThreshold) * (transmittance * scatter); // (transmittance * scatter)
cloudColor += factor * illumination.color;
}

View file

@ -17,7 +17,7 @@ struct CloudSettings
float scale = 10;
float densityOffset = -0.57f;
float densityIntensity = 7.0f; // 7.0f
float darknessThreshold = 0.2f; // 0.07f
float darknessThreshold = 0.07f; // 0.07f
float shadowIntensity = 0.6f;
float shadowLightAbsorption = 1;
float lightAbsorptionTowardsLight = 1.0f;