summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders
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
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')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl20
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/materialF.glsl16
2 files changed, 23 insertions, 13 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
index 7dc2fb4cc0..241857dd92 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
@@ -96,12 +96,12 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec
float dist = length(lv);
float da = 1.0;
- if (dist > la)
+ /*if (dist > la)
{
return col;
}
- /* clip to projector bounds
+ clip to projector bounds
vec4 proj_tc = proj_mat * lp;
if (proj_tc.z < 0
@@ -116,15 +116,15 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec
if (dist > 0.0 && la > 0.0)
{
- dist /= la;
+ dist /= la;
//normalize light vector
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;
if (dist_atten <= 0.0)
{
@@ -137,10 +137,11 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec
//angular attenuation
da *= dot(n, lv);
+ da = max(0.0, da);
float lit = 0.0f;
- float amb_da = ambiance;
+ float amb_da = 0.0;//ambiance;
if (da > 0)
{
lit = max(da * dist_atten,0.0);
@@ -151,7 +152,8 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec
amb_da *= dist_atten;
amb_da = min(amb_da, 1.0f - lit);
- col.rgb += amb_da * light_col * diffuse;
+ // SL-10969 ... need to work out why this blows out in many setups...
+ //col.rgb += amb_da * light_col * diffuse;
// no spec for alpha shader...
}
@@ -174,13 +176,14 @@ void main()
#endif
#ifdef USE_DIFFUSE_TEX
- vec4 diffuse_srgb = texture2D(diffuseMap,vary_texcoord0.xy);
+ vec4 diffuse_tap = texture2D(diffuseMap,vary_texcoord0.xy);
#endif
#ifdef USE_INDEXED_TEX
- vec4 diffuse_srgb = diffuseLookup(vary_texcoord0.xy);
+ vec4 diffuse_tap = diffuseLookup(vary_texcoord0.xy);
#endif
+ vec4 diffuse_srgb = diffuse_tap;
vec4 diffuse_linear = vec4(srgb_to_linear(diffuse_srgb.rgb), diffuse_srgb.a);
#ifdef FOR_IMPOSTOR
@@ -205,7 +208,6 @@ void main()
#ifdef USE_VERTEX_COLOR
float final_alpha = diffuse_linear.a * vertex_color.a;
- diffuse_srgb.rgb *= vertex_color.rgb;
diffuse_linear.rgb *= vertex_color.rgb;
#else
float final_alpha = diffuse_linear.a;
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;