summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2011-07-27 01:04:53 -0500
committerDave Parks <davep@lindenlab.com>2011-07-27 01:04:53 -0500
commite16eb4ae4a73125bc4e74fc667aa99110ac77c29 (patch)
tree14d873901a0027297271fc12194575eb8bdc61a2 /indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
parente7474eb48d3f5627a781cc25c96d721aa08b9629 (diff)
SH-1990 Fix for redundantly applying some color scaling to sky and water (also add some snazzy specular bloom from the sun)
Diffstat (limited to 'indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl')
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl59
1 files changed, 37 insertions, 22 deletions
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
index 66a1a8515f..f0c9b01671 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
@@ -267,34 +267,49 @@ void main()
float da = max(dot(norm.xyz, vary_light.xyz), 0.0);
vec4 diffuse = texture2DRect(diffuseRect, tc);
- vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy);
-
- vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg;
- float scol = max(scol_ambocc.r, diffuse.a);
- float ambocc = scol_ambocc.g;
+
+ vec3 col;
+ float bloom = 0.0;
+
+ if (diffuse.a < 0.9)
+ {
+ vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy);
+
+ vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg;
+ float scol = max(scol_ambocc.r, diffuse.a);
+ float ambocc = scol_ambocc.g;
- calcAtmospherics(pos.xyz, ambocc);
+ calcAtmospherics(pos.xyz, ambocc);
- vec3 col = atmosAmbient(vec3(0));
- col += atmosAffectDirectionalLight(max(min(da, scol), diffuse.a));
+ col = atmosAmbient(vec3(0));
+ col += atmosAffectDirectionalLight(max(min(da, scol), diffuse.a));
- col *= diffuse.rgb;
+ col *= diffuse.rgb;
- if (spec.a > 0.0) // specular reflection
+ if (spec.a > 0.0) // specular reflection
+ {
+ // the old infinite-sky shiny reflection
+ //
+ vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
+ float sa = dot(refnormpersp, vary_light.xyz);
+ vec3 dumbshiny = vary_SunlitColor*scol_ambocc.r*texture2D(lightFunc, vec2(sa, spec.a)).a;
+
+ // add the two types of shiny together
+ vec3 spec_contrib = dumbshiny * spec.rgb;
+ bloom = dot(spec_contrib, spec_contrib);
+ col += spec_contrib;
+ }
+
+ col = atmosLighting(col);
+ col = scaleSoftClip(col);
+
+ col = mix(col, diffuse.rgb, diffuse.a);
+ }
+ else
{
- // the old infinite-sky shiny reflection
- //
- vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
- float sa = dot(refnormpersp, vary_light.xyz);
- vec3 dumbshiny = vary_SunlitColor*scol_ambocc.r*texture2D(lightFunc, vec2(sa, spec.a)).a;
-
- // add the two types of shiny together
- col += dumbshiny * spec.rgb;
+ col = diffuse.rgb;
}
-
- col = atmosLighting(col);
- col = scaleSoftClip(col);
gl_FragColor.rgb = col;
- gl_FragColor.a = 0.0;
+ gl_FragColor.a = bloom;
}