summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2019-06-18 13:14:27 -0700
committerGraham Linden <graham@lindenlab.com>2019-06-18 13:14:27 -0700
commit4abb342e9564a7740475c3abe60cd62ae5bbc34d (patch)
tree4136f395983ce0b6883e5dc86b9b42615b40b52d /indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
parente7ac7d766d1c817ad43d5bf0b5bba7f07495395b (diff)
SL-10969
Remove ambiance handling from alpha and blended materials objects for now. Still too many setups where they get blown out due to attenuation mismatches with deferred.
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred/materialF.glsl')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/materialF.glsl16
1 files changed, 12 insertions, 4 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
index 571d0dd17a..8ebb2f44d3 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
@@ -117,6 +117,7 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe
lv = normalize(lv);
//distance attenuation
+ fa += 1.0f;
float dist_atten = clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0);
dist_atten *= dist_atten;
//dist_atten *= 2.0f;
@@ -136,7 +137,7 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe
float lit = 0.0f;
float amb_da = ambiance;
- if (da > 0)
+ if (da >= 0)
{
lit = max(da * dist_atten,0.0);
col = lit * light_col * diffuse;
@@ -146,7 +147,8 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe
amb_da *= dist_atten;
amb_da = min(amb_da, 1.0f - lit);
- col.rgb += amb_da * light_col * diffuse;
+ // SL-10969 need to see why these are blown out
+ //col.rgb += amb_da * light_col * diffuse;
if (spec.a > 0.0)
{
@@ -225,8 +227,14 @@ void main()
vec2 pos_screen = vary_texcoord0.xy;
vec4 diffuse_tap = texture2D(diffuseMap, vary_texcoord0.xy);
+
+#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
+ vec4 diffuse_srgb = diffuse_tap;
+ vec4 diffuse_linear = vec4(srgb_to_linear(diffuse_srgb.rgb), diffuse_srgb.a);
+#else
vec4 diffuse_linear = diffuse_tap;
- vec4 diffuse_srgb = vec4(linear_to_srgb(diffuse_linear.rgb), diffuse_tap.a);
+ vec4 diffuse_srgb = vec4(linear_to_srgb(diffuse_linear.rgb), diffuse_linear.a);
+#endif
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_MASK)
if (diffuse_linear.a < minimum_alpha)
@@ -338,7 +346,7 @@ vec3 post_ambient = color.rgb;
vec3 post_sunlight = color.rgb;
- color.rgb *= diffuse_linear.rgb;
+ color.rgb *= diffuse_srgb.rgb;
vec3 post_diffuse = color.rgb;