diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl
index 32e9714a7504b1e512d6c149ce62066d2f8a536f..1a344045fea2c941f4008d16f3ae46569452fa1e 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl
@@ -48,6 +48,24 @@ void main()
         discard;
     }
 
+#if !defined(IS_FULLBRIGHT)
+    alpha *= vertex_color.a;
+#endif
+
+    if (alpha < 0.05) // treat as totally transparent
+    {
+        discard;
+    }
+
+    if (alpha < 0.88) // treat as semi-transparent
+    {
+        if (fract(0.5*floor(target_pos_x / post_pos.w )) < 0.25)
+        {
+            discard;
+        }
+    }
+
+
 	frag_color = vec4(1,1,1,1);
 	
 #if !defined(DEPTH_CLAMP)