summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class2
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2019-02-22 22:58:49 +0000
committerRider Linden <rider@lindenlab.com>2019-02-22 22:58:49 +0000
commit8bebb385fe1f7df22c7fd040eceaaf1b3bcbef75 (patch)
tree131af8acc2dcb8c127ffcf13442e8fd3c95e880d /indra/newview/app_settings/shaders/class2
parentd60925e3b4c49f6203be01a56b584c70da8eb506 (diff)
parent4aad62006259c20bcdda1495138f7313b8f35e8d (diff)
Merged in graham_linden/viewer-eep-fixes (pull request #282)
SL-10415, SL-10612, SL-10569
Diffstat (limited to 'indra/newview/app_settings/shaders/class2')
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl35
1 files changed, 17 insertions, 18 deletions
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
index 8bc9add5cf..7fd4d7e248 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
@@ -90,17 +90,16 @@ void main()
vec4 norm = texture2DRect(normalMap, tc);
float envIntensity = norm.z;
norm.xyz = getNorm(tc); // unpack norm
-
- float da_sun = dot(norm.xyz, sun_dir.xyz);
- float da_moon = dot(norm.xyz, moon_dir.xyz);
- float da = (sun_up_factor == 1) ? da_sun : da_moon;
- da = clamp(da, 0.0, 1.0);
- da = pow(da, global_gamma + 0.3);
+ vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir;
+
+ float da = dot(norm.xyz, light_dir.xyz);
+ da = clamp(da, 0.0, 1.0);
vec4 diffuse = texture2DRect(diffuseRect, tc);
vec3 col;
+ float scol = 1.0;
float bloom = 0.0;
{
vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy);
@@ -108,9 +107,13 @@ void main()
vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg;
scol_ambocc = pow(scol_ambocc, vec2(global_gamma + 0.3));
- float scol = max(scol_ambocc.r, diffuse.a);
+ scol = max(scol_ambocc.r, diffuse.a);
float ambocc = scol_ambocc.g;
+ float final_da = da;
+ final_da = min(final_da, scol);
+ final_da = pow(final_da, global_gamma + 0.3);
+
vec3 sunlit;
vec3 amblit;
vec3 additive;
@@ -118,18 +121,17 @@ void main()
calcFragAtmospherics(pos.xyz, ambocc, sunlit, amblit, additive, atten);
- float ambient = da;
-
+ float ambient = min(da, 1.0);
ambient *= 0.5;
ambient *= ambient;
- ambient = (1.0-ambient);
-
- col.rgb = amblit;
- col.rgb *= min(ambient, max(scol, 0.5));
+ ambient = min(1.0 - ambient,max(scol,0.3));
- col += sunlit * da * scol;
+ vec3 sun_contrib = sunlit * final_da;
- col *= diffuse.rgb;
+ col.rgb = amblit;
+ col.rgb *= ambient;
+ col.rgb += sun_contrib;
+ col.rgb *= diffuse.rgb;
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
@@ -165,9 +167,6 @@ void main()
col = fogged.rgb;
bloom = fogged.a;
#endif
-
-//col.rgb = vec3(scol);
-//col.rgb = vec3(da * scol);
}
frag_color.rgb = col;
frag_color.a = bloom;