summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl
diff options
context:
space:
mode:
authorAdam Moss <c@yotes.com>2012-04-21 17:35:50 +0100
committerAdam Moss <c@yotes.com>2012-04-21 17:35:50 +0100
commit9ce481a5ac41777539416da3e0ec92b098af3e49 (patch)
treeecbfe2c2ad172d52c12807c49c8ca0c741e6af91 /indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl
parent19e0cc93a8af661dbac47552474a704ade600c74 (diff)
STORM-1819: Ternary/graded shadow support
Coalesced patchset.
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl21
1 files changed, 18 insertions, 3 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl
index cf8cf8364a..07d5b08191 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl
@@ -29,11 +29,18 @@ out vec4 frag_color;
#define frag_color gl_FragColor
#endif
+uniform mat4 modelview_projection_matrix;
+
uniform float minimum_alpha;
uniform sampler2D diffuseMap;
-VARYING vec4 post_pos;
+//flat VARYING int foo;
+VARYING float pos_zd2;
+VARYING float pos_w;
+VARYING float target_pos_x;
+//VARYING vec4 pre_pos;
+//VARYING vec4 post_pos;
VARYING vec4 vertex_color;
VARYING vec2 vary_texcoord0;
@@ -41,12 +48,20 @@ void main()
{
float alpha = diffuseLookup(vary_texcoord0.xy).a * vertex_color.a;
- if (alpha < minimum_alpha)
+ 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 / pos_w )) < 0.25)
+ {
+ discard;
+ }
+ }
+
frag_color = vec4(1,1,1,1);
- gl_FragDepth = max(post_pos.z/post_pos.w*0.5+0.5, 0.0);
+ gl_FragDepth = max(pos_zd2/pos_w+0.5, 0.0);
}