summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class1/deferred
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2019-04-08 16:53:57 -0700
committerGraham Linden <graham@lindenlab.com>2019-04-08 16:53:57 -0700
commit996d441ddc64996711b5a4eb3135607686992b86 (patch)
tree55129c482873d34564f4a48fb06e681c93ad1112 /indra/newview/app_settings/shaders/class1/deferred
parent759525040ac11a2edee541c944ad0c6e9cc04d0f (diff)
SL-5186
Make projector ambiance unshadowed in both forward and deferred for consistency.
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl19
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/materialF.glsl17
2 files changed, 16 insertions, 20 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
index fb24927b26..4b99592dbb 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
@@ -99,8 +99,7 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec
lv = normalize(lv);
vec3 norm = normalize(n);
- da = max(0.0, dot(norm, lv));
- //da = min(da, shadow);
+ da = dot(norm, lv);
da = clamp(da, 0.0, 1.0);
//distance attenuation
@@ -116,18 +115,15 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec
// to match spotLight (but not multiSpotLight) *sigh*
float lit = max(da * dist_atten,0.0);
- // the shadowmap is wrong for alpha objects
- // since we only have 2 maps but N spots
- //col = lit * light_col * diffuse * shadow;
- col = lit * light_col * diffuse;
+ col = lit * light_col * diffuse * shadow;
float amb_da = ambiance;
- amb_da += (da*0.5) * (1.0 - shadow) * ambiance;
+ amb_da += (da*0.5+0.5) * (1.0 - shadow) * ambiance;
amb_da += (da*da*0.5 + 0.5) * (1.0 - shadow) * ambiance;
amb_da *= dist_atten;
amb_da = min(amb_da, 1.0f - lit);
- col.rgb += amb_da * light_col * diffuse;
+ col.rgb += amb_da * 0.5 * light_col * diffuse;
// no spec for alpha shader...
}
col = max(col, vec3(0));
@@ -234,7 +230,7 @@ vec3 post_diffuse = color.rgb;
vec3 prelight_linearish_maybe = color.rgb;
- #define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, diff.rgb, pos.xyz, norm, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, light_attenuation[i].w, shadow);
+ #define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, diff.rgb, pos.xyz, norm, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, light_attenuation[i].w, 1.0);
LIGHT_LOOP(1)
LIGHT_LOOP(2)
@@ -244,16 +240,17 @@ vec3 prelight_linearish_maybe = color.rgb;
LIGHT_LOOP(6)
LIGHT_LOOP(7)
+vec3 light_linear = light.rgb;
+
// keep it linear
//
color.rgb += light.rgb;
vec3 postlight_linear = color.rgb;
-color.rgb = prelight_linearish_maybe;
+//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 4bb01824bf..8c5a0ef297 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
@@ -112,23 +112,20 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe
//angular attenuation
da = dot(n, lv);
- //da = min(da, shadow);
- da *= clamp(da, 0.0, 1.0);
+ da = clamp(da, 0.0, 1.0);
float lit = max(da * dist_atten, 0.0);
// shadowmap is wrong for alpha-blended objs
// since we created shadowmaps for 2 but render N
- //col = light_col*lit*diffuse*shadow;
- col = light_col*lit*diffuse;
+ col = light_col*lit*diffuse*shadow;
float amb_da = ambiance;
- amb_da += (da*0.5) * (1.0 - shadow) * ambiance;
+ amb_da += (da*0.5+0.5) * (1.0 - shadow) * ambiance;
amb_da += (da*da*0.5 + 0.5) * (1.0 - shadow) * ambiance;
- amb_da *= dist_atten;
amb_da = min(amb_da, 1.0f - lit);
- col.rgb += amb_da * light_col * diffuse;
+ col.rgb += amb_da * 0.5 * light_col * diffuse;
if (spec.a > 0.0)
{
@@ -373,7 +370,7 @@ vec3 post_spec = col.rgb;
vec3 prelight_linearish_maybe = col.rgb;
- #define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, npos, diffuse.rgb, final_specular, pos.xyz, norm.xyz, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, glare, light_attenuation[i].w, shadow);
+ #define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, npos, diffuse.rgb, final_specular, pos.xyz, norm.xyz, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, glare, light_attenuation[i].w, 1.0);
LIGHT_LOOP(1)
LIGHT_LOOP(2)
@@ -383,6 +380,8 @@ vec3 post_spec = col.rgb;
LIGHT_LOOP(6)
LIGHT_LOOP(7)
+vec3 light_linear = light.rgb;
+
col.rgb += light.rgb;
vec3 postlight_linear = col.rgb;
@@ -396,7 +395,7 @@ vec3 postlight_linear = col.rgb;
al = temp.a;
#endif
-//col.rgb = prelight_linearish_maybe;
+//col.rgb = light_linear;
col.rgb = linear_to_srgb(col.rgb);