From 21c1941a4f4780c0675ae338cbbc5899aa7c0613 Mon Sep 17 00:00:00 2001 From: Graham Linden <graham@lindenlab.com> Date: Mon, 6 May 2019 10:16:31 -0700 Subject: [PATCH] Fix missin atten and atten only applied when da > 0 in material and alpha shaders resp. --- .../app_settings/shaders/class1/deferred/alphaF.glsl | 7 +++---- .../app_settings/shaders/class1/deferred/materialF.glsl | 3 ++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index c4d89f29f69..2112fa8251e 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl @@ -136,9 +136,9 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec col = lit * light_col * diffuse; amb_da += (da*0.5+0.5) * ambiance; amb_da += (da*da*0.5 + 0.5) * ambiance; - amb_da *= dist_atten; - amb_da = min(amb_da, 1.0f - lit); } + amb_da *= dist_atten; + amb_da = min(amb_da, 1.0f - lit); col.rgb += amb_da * 0.5 * light_col * diffuse; // no spec for alpha shader... @@ -240,7 +240,7 @@ vec3 post_sunlight = color.rgb; vec3 post_diffuse = color.rgb; - //color.rgb = mix(diffuse_srgb.rgb, color.rgb, final_alpha); + //color.rgb = mix(diffuse_linear.rgb, color.rgb, final_alpha); color.rgb = atmosFragLighting(color.rgb, additive, atten); color.rgb = scaleSoftClipFrag(color.rgb); @@ -268,7 +268,6 @@ vec3 post_atmo = color.rgb; // back to sRGB as we're going directly to the final RT post-deferred gamma correction color.rgb = linear_to_srgb(color.rgb); - //color.rgb = amblit; //color.rgb = vec3(ambient); //color.rgb = sunlit; diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index 64cdacd4a2e..ba1f121bfde 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -144,8 +144,9 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe col = light_col*lit*diffuse; amb_da += (da*0.5 + 0.5) * ambiance; amb_da += (da*da*0.5+0.5) * ambiance; - amb_da = min(amb_da, 1.0f - lit); } + amb_da *= dist_atten; + amb_da = min(amb_da, 1.0f - lit); col.rgb += amb_da * 0.25 * light_col * diffuse; if (spec.a > 0.0) -- GitLab