summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class2
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2019-02-22 15:05:13 -0800
committerRider Linden <rider@lindenlab.com>2019-02-22 15:05:13 -0800
commit0aa46bb013e888d437054bfb31efe5fa1136d1ba (patch)
treecf36b48b801a57c8c1f6691e7112980d8f9ab1c8 /indra/newview/app_settings/shaders/class2
parent8382cc2f2c2944e8a2a47e30dc22b1eb99ce34cb (diff)
parent8bebb385fe1f7df22c7fd040eceaaf1b3bcbef75 (diff)
Merge
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;