From a2eefed128459253d744baefb55a245db0b0a1a3 Mon Sep 17 00:00:00 2001 From: Rye Mutt <rye@alchemyviewer.org> Date: Sat, 21 Aug 2021 09:32:35 -0400 Subject: [PATCH] Fix alpha lighting producing undefined results that are different depending on driver --- .../app_settings/shaders/class1/deferred/alphaF.glsl | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index 9afa7e36f8e..dd424b6fe78 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl @@ -216,12 +216,9 @@ void main() calcAtmosphericVars(pos.xyz, light_dir, 1.0, sunlit, amblit, additive, atten, false); - float da = dot(norm.xyz, light_dir.xyz); - da = clamp(da, -1.0, 1.0); - da = pow(da, 1.0/1.3); - - float final_da = da; - final_da = clamp(final_da, 0.0f, 1.0f); + + float da = clamp(dot(norm.xyz, light_dir.xyz), 0.0, 1.0); + da = pow(da, 1.0 / 1.3); vec4 color = vec4(0.0); @@ -232,7 +229,7 @@ void main() ambient *= ambient; ambient = (1.0 - ambient); - vec3 sun_contrib = min(final_da, shadow) * sunlit; + vec3 sun_contrib = min(da, shadow) * sunlit; #if !defined(AMBIENT_KILL) color.rgb = amblit; -- GitLab