From 2ffa387560d26acdd90a32321f593036fa36c294 Mon Sep 17 00:00:00 2001
From: Geenz <geenz@geenzo.com>
Date: Thu, 7 Aug 2014 16:50:36 -0400
Subject: [PATCH] Glossy reflections for projectors.

---
 .../shaders/class1/deferred/multiSpotLightF.glsl          | 6 +++---
 .../app_settings/shaders/class1/deferred/spotLightF.glsl  | 6 +++---
 .../shaders/class2/deferred/multiSpotLightF.glsl          | 8 ++++----
 .../app_settings/shaders/class2/deferred/spotLightF.glsl  | 6 +++---
 4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
index c299d894552..63ad6fa7c72 100755
--- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
@@ -314,16 +314,16 @@ void main()
 			stc /= stc.w;
 			if (stc.z > 0.0)
 			{
-				float fatten = clamp(envIntensity*envIntensity+envIntensity*0.25, 0.25, 1.0);
+				float fatten = clamp(spec.a*spec.a+spec.a*0.25, 0.25, 1.0);
 				
-				stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5);
+				stc.xy = (stc.xy - vec2(0.5)) + vec2(0.5);
 								
 				if (stc.x < 1.0 &&
 					stc.y < 1.0 &&
 					stc.x > 0.0 &&
 					stc.y > 0.0)
 				{
-					col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, proj_lod).rgb * envIntensity;
+					col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, (1 - spec.a * spec.a) * (proj_lod * 0.5)).rgb * envIntensity;
 				}
 			}
 		}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
index 5094513e529..6d282115ddc 100755
--- a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
@@ -324,17 +324,17 @@ void main()
 			{
 				stc.xy /= stc.w;
 
-				float fatten = clamp(envIntensity*envIntensity+envIntensity*0.5, 0.25, 1.0);
+				float fatten = clamp(spec.a*spec.a+spec.a*0.25, 0.25, 1.0);
 				
 				//stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5);
-				stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5);
+				stc.xy = (stc.xy - vec2(0.5)) + vec2(0.5);
 								
 				if (stc.x < 1.0 &&
 					stc.y < 1.0 &&
 					stc.x > 0.0 &&
 					stc.y > 0.0)
 				{
-					col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, proj_lod).rgb * envIntensity;
+					col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, (1 - spec.a * spec.a) * (proj_lod * 0.5)).rgb * envIntensity;
 				}
 			}
 		}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
index 2117056b6c0..d5bc56e27af 100755
--- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
@@ -338,16 +338,16 @@ void main()
 
 			if (stc.z > 0.0)
 			{
-				float fatten = clamp(envIntensity*envIntensity+envIntensity*0.25, 0.25, 1.0);
-
-				stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5);
+				float fatten = clamp(spec.a*spec.a+spec.a*0.25, 0.25, 1.0);
+                
+				stc.xy = (stc.xy - vec2(0.5)) + vec2(0.5);
 								
 				if (stc.x < 1.0 &&
 					stc.y < 1.0 &&
 					stc.x > 0.0 &&
 					stc.y > 0.0)
 				{
-					col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, proj_lod).rgb * shadow * envIntensity;
+					col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, (1 - spec.a * spec.a) * (proj_lod * 0.5)).rgb * shadow * envIntensity;
 				}
 			}
 		}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
index 08f5438e8a8..56b01eff8c7 100755
--- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
@@ -338,17 +338,17 @@ void main()
 			{
 				stc.xy /= stc.w;
 
-				float fatten = clamp(envIntensity*envIntensity+envIntensity*0.5, 0.25, 1.0);
+				float fatten = clamp(spec.a*spec.a+spec.a*0.25, 0.25, 1.0);
 				
 				//stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5);
-				stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5);
+				stc.xy = (stc.xy - vec2(0.5)) + vec2(0.5);
 								
 				if (stc.x < 1.0 &&
 					stc.y < 1.0 &&
 					stc.x > 0.0 &&
 					stc.y > 0.0)
 				{
-					col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, proj_lod).rgb * shadow * envIntensity;
+					col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, (1 - spec.a * spec.a) * (proj_lod * 0.5)).rgb * shadow * envIntensity;
 				}
 			}
 		}
-- 
GitLab