Slightly improved cloud lighting

This commit is contained in:
Michaël Lemaire 2015-09-24 00:13:52 +02:00
parent 704fe839d9
commit ba02442fea

View file

@ -176,13 +176,11 @@ Color CloudBasicLayerRenderer::getColor(BaseCloudsModel *model, const Vector3 &e
col = parent->applyLightingToSurface(segments[i].start, parent->getAtmosphereRenderer()->getSunDirection(), material); col = parent->applyLightingToSurface(segments[i].start, parent->getAtmosphereRenderer()->getSunDirection(), material);
double power = col.getPower(); // Boost highly lighted area
if (power > 0.2) double boost = 1.0 + (col.getPower() * col.getPower());
{ col.r *= boost;
col.r += (power - 0.2) * 1.5; col.g *= boost;
col.g += (power - 0.2) * 1.5; col.b *= boost;
col.b += (power - 0.2) * 1.5;
}
col.a = (segments[i].length >= transparency_depth) ? 1.0 : (segments[i].length / transparency_depth); col.a = (segments[i].length >= transparency_depth) ? 1.0 : (segments[i].length / transparency_depth);
result.mask(col); result.mask(col);
@ -235,9 +233,13 @@ bool CloudBasicLayerRenderer::alterLight(BaseCloudsModel *model, LightComponent*
{ {
factor = 1.0; factor = 1.0;
} }
else if (factor > 0.00001)
{
factor = sqrt(factor);
}
} }
double miminum_light = 0.3; double miminum_light = 0.5;
factor = 1.0 - (1.0 - miminum_light) * factor; factor = 1.0 - (1.0 - miminum_light) * factor;
light->color.r *= factor; light->color.r *= factor;