SL-10856
Modify calc of sunlight to avoid clipping in gamma correct on values outside 0-1 range. Modify shaders to put back ambient clamp tuned to be close to ambient contrib in low/mid lighting.meow-7.2.2
parent
4e9111bbd4
commit
b143aa96fc
|
|
@ -32,6 +32,10 @@
|
|||
#include "llfasttimer.h"
|
||||
#include "v3colorutil.h"
|
||||
|
||||
#if LL_WINDOWS
|
||||
#pragma optimize("", off)
|
||||
#endif
|
||||
|
||||
//=========================================================================
|
||||
namespace
|
||||
{
|
||||
|
|
@ -1276,8 +1280,10 @@ void LLSettingsSky::calculateLightSettings() const
|
|||
LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow;
|
||||
|
||||
//brightness of surface both sunlight and ambient
|
||||
mSunDiffuse = gammaCorrect(componentMult(sunlight, light_transmittance));
|
||||
mSunAmbient = gammaCorrect(componentMult(tmpAmbient, light_transmittance));
|
||||
// reduce range to 0 - 1 before gamma correct to prevent clipping
|
||||
// then restore to full 0 - 3 range before storage
|
||||
mSunDiffuse = gammaCorrect(componentMult(sunlight * 0.33333f, light_transmittance)) * 3.0f;
|
||||
mSunAmbient = gammaCorrect(componentMult(tmpAmbient * 0.33333f, light_transmittance)) * 3.0f;
|
||||
|
||||
F32 moon_brightness = getIsMoonUp() ? getMoonBrightness() : 0.001f;
|
||||
|
||||
|
|
|
|||
|
|
@ -223,8 +223,7 @@ void main()
|
|||
float ambient = da;
|
||||
ambient *= 0.5;
|
||||
ambient *= ambient;
|
||||
//ambient = max(getAmbientClamp(), ambient); // keeps shadows dark
|
||||
ambient = 1.0 - ambient;
|
||||
ambient = min(getAmbientClamp(), 1.0 - ambient);
|
||||
|
||||
vec3 sun_contrib = min(final_da, shadow) * sunlit;
|
||||
|
||||
|
|
|
|||
|
|
@ -320,8 +320,7 @@ void main()
|
|||
float ambient = da;
|
||||
ambient *= 0.5;
|
||||
ambient *= ambient;
|
||||
//ambient = max(getAmbientClamp(), ambient);
|
||||
ambient = 1.0 - ambient;
|
||||
ambient = min(getAmbientClamp(), 1.0 - ambient);
|
||||
|
||||
vec3 sun_contrib = min(final_da, shadow) * sunlit;
|
||||
|
||||
|
|
|
|||
|
|
@ -106,8 +106,7 @@ void main()
|
|||
float ambient = da;
|
||||
ambient *= 0.5;
|
||||
ambient *= ambient;
|
||||
//ambient = max(getAmbientClamp(), ambient);
|
||||
ambient = 1.0 - ambient;
|
||||
ambient = min(getAmbientClamp(), 1.0 - ambient);
|
||||
|
||||
vec3 sun_contrib = final_da * sunlit;
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ uniform float sun_moon_glow_factor;
|
|||
|
||||
float getAmbientClamp()
|
||||
{
|
||||
return 0.66f;
|
||||
return 0.2f;
|
||||
}
|
||||
|
||||
void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten) {
|
||||
|
|
@ -137,7 +137,7 @@ void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, o
|
|||
+ tmpAmbient));
|
||||
|
||||
//brightness of surface both sunlight and ambient
|
||||
sunlit = sunlight.rgb * 0.5;
|
||||
amblit = tmpAmbient.rgb * .25;
|
||||
sunlit = sunlight.rgb;
|
||||
amblit = tmpAmbient.rgb;
|
||||
additive *= vec3(1.0 - temp1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,8 +116,7 @@ void main()
|
|||
float ambient = da;
|
||||
ambient *= 0.5;
|
||||
ambient *= ambient;
|
||||
//ambient = max(getAmbientClamp(), ambient);
|
||||
ambient = 1.0 - ambient;
|
||||
ambient = min(getAmbientClamp(), 1.0 - ambient);
|
||||
|
||||
vec3 sun_contrib = min(scol, final_da) * sunlit;
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ vec4 sumLights(vec3 pos, vec3 norm, vec4 color);
|
|||
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color)
|
||||
{
|
||||
vec4 c = sumLights(pos, norm, color);
|
||||
c.rgb += atmosAmbient() * color.rgb;
|
||||
c.rgb += atmosAmbient() * color.rgb * 0.25;
|
||||
return c;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue