From 5d5cb7a08344915a11bb43954212444fec073e7c Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Wed, 20 Oct 2010 14:37:24 -0500
Subject: [PATCH] Fix for broken shadows on rigged attachments when attachment
 penetrates shadow frustum near clip plane.

---
 .../shaders/class1/deferred/attachmentShadowV.glsl          | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl
index 1626e21cd88..5ae41cb7309 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl
@@ -1,5 +1,5 @@
 /** 
- * @file diffuseSkinnedV.glsl
+ * @file attachmentShadowV.glsl
  *
  * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
  * $License$
@@ -21,5 +21,7 @@ void main()
 	
 	gl_FrontColor = gl_Color;
 	
-	gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0);
+	vec4 p = gl_ProjectionMatrix * vec4(pos, 1.0);
+	p.z = max(p.z, -p.w+0.01);
+	gl_Position = p;
 }
-- 
GitLab