summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2019-04-25 13:02:24 -0700
committerGraham Linden <graham@lindenlab.com>2019-04-25 13:02:24 -0700
commit5766325290974ee2cfa30fd655060ef396d1e87a (patch)
tree3a75f4bd27f5aeb51f4bad0b1235603d924540c9
parent48ed3f9318cf3750f1c4f72d1e7195f06d06e53c (diff)
SL-10904, SL-10998, SL-11018
Fix handling of 1/light_y when y was tiny but getting even tinier. Add similar adjustment to shader version of same calc.
-rw-r--r--indra/llinventory/llsettingssky.cpp10
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl8
3 files changed, 11 insertions, 11 deletions
diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp
index 07a03f0315..1490708ca5 100644
--- a/indra/llinventory/llsettingssky.cpp
+++ b/indra/llinventory/llsettingssky.cpp
@@ -1275,12 +1275,14 @@ void LLSettingsSky::calculateLightSettings() const
LLColor3 light_transmittance = getLightTransmittance();
// and vary_sunlight will work properly with moon light
- F32 lighty = lightnorm[2];
- if(fabs(lighty) > 0.001f)
+ const F32 LIMIT = FLT_EPSILON * 8.0f;
+
+ F32 lighty = fabs(lightnorm[2]);
+ if(lighty >= LIMIT)
{
- lighty = 1.f / fabs(lighty);
+ lighty = 1.f / lighty;
}
- lighty = llmax(0.001f, lighty);
+ lighty = llmax(LIMIT, lighty);
componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty));
//increase ambient when there are more clouds
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
index 8709053ac6..300900a9e5 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
@@ -229,13 +229,11 @@ vec3 post_diffuse = color.rgb;
//color.rgb = mix(diff.rgb, color.rgb, final_alpha);
- color.rgb = atmosFragLighting(color.rgb, additive, atten);
+ color.rgb = atmosFragLighting(color.rgb, additive, atten) * 2.0;
color.rgb = scaleSoftClipFrag(color.rgb);
vec4 light = vec4(0,0,0,0);
-vec3 prelight_linearish_maybe = srgb_to_linear(color.rgb);
-
#define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, diff.rgb, pos.xyz, norm, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, light_attenuation[i].w * 0.5);
LIGHT_LOOP(1)
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
index 09fb3e4c8a..93513acabe 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
@@ -81,12 +81,12 @@ void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, o
haze_weight = vec4(haze_density) / temp1;
//(TERRAIN) compute sunlight from lightnorm only (for short rays like terrain)
- temp2.y = max(0.0, tmpLightnorm.z);
- if (temp2.y > 0.001f)
+ temp2.y = max(0.0, tmpLightnorm.y);
+ if (abs(temp2.y) > 0.000001f)
{
- temp2.y = 1. / temp2.y;
+ temp2.y = 1. / abs(temp2.y);
}
- temp2.y = max(0.001f, temp2.y);
+ temp2.y = max(0.0000001f, temp2.y);
sunlight *= exp(-light_atten * temp2.y);
// main atmospheric scattering line integral