summaryrefslogtreecommitdiff
path: root/indra/newview/lllegacyatmospherics.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/lllegacyatmospherics.cpp')
-rw-r--r--indra/newview/lllegacyatmospherics.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/indra/newview/lllegacyatmospherics.cpp b/indra/newview/lllegacyatmospherics.cpp
index 68613be19c..10603cf819 100644
--- a/indra/newview/lllegacyatmospherics.cpp
+++ b/indra/newview/lllegacyatmospherics.cpp
@@ -321,22 +321,18 @@ void LLAtmospherics::calcSkyColorWLVert(LLVector3 & Pn, AtmosphericsVars& vars)
}
// Compute sunlight from P & lightnorm (for long rays like sky)
- temp2.mV[1] = llmax(F_APPROXIMATELY_ZERO, llmax(0.f, lighty));
-
- if (temp2.mV[1] > 0.0000001f)
- {
- temp2.mV[1] = 1.f / temp2.mV[1];
- }
- temp2.mV[1] = llmax(temp2.mV[1], 0.0000001f);
+ temp2.mV[1] = llmax(F_APPROXIMATELY_ZERO, llmax(0.f, Pn[1]) * 1.0f + sun_norm.mV[1] );
+ temp2.mV[1] = 1.f / temp2.mV[1];
componentMultBy(sunlight, componentExp((light_atten * -1.f) * temp2.mV[1]));
- componentMultBy(sunlight, light_transmittance);
+ //componentMultBy(sunlight, light_transmittance);
// Distance
temp2.mV[2] = Plen * density_multiplier;
// Transparency (-> temp1)
- temp1 = componentExp((temp1 * -1.f) * temp2.mV[2] * distance_multiplier);
+ temp1 = componentExp((temp1 * -1.f) * temp2.mV[2]);// * distance_multiplier);
+ (void)distance_multiplier;
// Compute haze glow
temp2.mV[0] = Pn * LLVector3(sun_norm);
@@ -347,7 +343,7 @@ void LLAtmospherics::calcSkyColorWLVert(LLVector3 & Pn, AtmosphericsVars& vars)
// Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot)
// Higher glow.x gives dimmer glow (because next step is 1 / "angle")
- temp2.mV[0] *= (glow.mV[0] > 0) ? glow.mV[0] : F32_MIN;
+ temp2.mV[0] *= glow.mV[0];
temp2.mV[0] = pow(temp2.mV[0], glow.mV[2]);
// glow.z should be negative, so we're doing a sort of (1 / "angle") function
@@ -374,10 +370,13 @@ void LLAtmospherics::calcSkyColorWLVert(LLVector3 & Pn, AtmosphericsVars& vars)
final_atten.mV[2] = llmax(final_atten.mV[2], 0.0f);
// Final atmosphere additive
- componentMultBy(vars.hazeColor, final_atten);
+ componentMultBy(vars.hazeColor, LLColor3::white - temp1);
+
+ // Attenuate cloud color by atmosphere
+ temp1 = componentSqrt(temp1); //less atmos opacity (more transparency) below clouds
// At horizon, blend high altitude sky color towards the darker color below the clouds
- vars.hazeColor += componentMult(vars.hazeColorBelowCloud - vars.hazeColor, final_atten);
+ vars.hazeColor += componentMult(vars.hazeColorBelowCloud - vars.hazeColor, LLColor3::white - componentSqrt(temp1));
}
void LLAtmospherics::updateFog(const F32 distance, const LLVector3& tosun_in)