summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class1/deferred
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2019-04-29 11:11:05 -0700
committerGraham Linden <graham@lindenlab.com>2019-04-29 11:11:05 -0700
commit0f83696585b8810c24d535432716215caf0c21e9 (patch)
tree25bcabd6ae10702922e887c701cde9eaf1a07335 /indra/newview/app_settings/shaders/class1/deferred
parenteff7acfb1caaa092a88555fca752dc9aea11625e (diff)
SL-10956, SL-10969
Don't ignore far z in culling. Fix Mid lighting being very dark. Partial fix for broken projectors with forward rendering.
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl15
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/materialF.glsl18
2 files changed, 16 insertions, 17 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
index 11fcb3e87a..1acb76bdd1 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
@@ -98,8 +98,9 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec
float da = 1.0;
vec3 col = vec3(0);
if (proj_tc.z < 0
- || proj_tc.x < 0
|| proj_tc.z > 1
+ || proj_tc.x < 0
+ || proj_tc.x > 1
|| proj_tc.y < 0
|| proj_tc.y > 1)
{
@@ -139,7 +140,9 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec
amb_da *= dist_atten;
amb_da = min(amb_da, 1.0f - lit);
+#ifndef NO_AMBIANCE
col.rgb += amb_da * 0.5 * light_col * diffuse;
+#endif
// no spec for alpha shader...
}
@@ -260,17 +263,9 @@ vec3 post_atmo = color.rgb;
LIGHT_LOOP(6)
LIGHT_LOOP(7)
-vec3 light_linear = light.rgb;
+ color.rgb = linear_to_srgb(color.rgb);
- // keep it linear
- //
color.rgb += light.rgb;
-
-vec3 postlight_linear = color.rgb;
-
-//color.rgb = light_linear;
-
- color.rgb = linear_to_srgb(color.rgb);
#endif
#ifdef WATER_FOG
diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
index f21b7644bb..cbb7a04631 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
@@ -101,8 +101,9 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe
vec4 proj_tc = proj_mat * lp;
if (proj_tc.z < 0
- || proj_tc.x < 0
|| proj_tc.z > 1
+ || proj_tc.x < 0
+ || proj_tc.x > 1
|| proj_tc.y < 0
|| proj_tc.y > 1)
{
@@ -119,7 +120,11 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe
fa += 1.0f;
float dist_atten = ( fa > 0) ? clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0) : 1.0f;
dist_atten *= dist_atten;
- dist_atten *= 2.0f;
+
+ if (dist_atten <= 0)
+ {
+ return col;
+ }
// spotlight coefficient.
float spot = max(dot(-ln, lv), is_pointlight);
@@ -141,7 +146,9 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe
amb_da += (da*da*0.5+0.5) * ambiance;
amb_da = min(amb_da, 1.0f - lit);
+#ifndef NO_AMBIANCE
col.rgb += amb_da * 0.5 * light_col * diffuse;
+#endif
if (spec.a > 0.0)
{
@@ -172,7 +179,6 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe
}
return max(col, vec3(0.0,0.0,0.0));
-
}
#else
@@ -405,10 +411,6 @@ vec3 post_atmo = col.rgb;
LIGHT_LOOP(6)
LIGHT_LOOP(7)
-vec3 light_linear = light.rgb;
-
- col.rgb += light_linear;
-
vec3 postlight_linear = col.rgb;
glare = min(glare, 1.0);
@@ -424,6 +426,8 @@ vec3 postlight_linear = col.rgb;
col.rgb = linear_to_srgb(col.rgb);
+ col.rgb += light.rgb;
+
frag_color.rgb = col.rgb;
frag_color.a = al;