summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2011-05-25 19:23:57 -0500
committerDave Parks <davep@lindenlab.com>2011-05-25 19:23:57 -0500
commita6fa155725205d1e6207abfe1112f92bbe38203d (patch)
tree3a504aca7858cf1166dd0d7119b9310447297648
parent3a2c3a45aa5db8592c75601ec1fbf43eea85ccb6 (diff)
Make avatars use same shadow offset magic as prims.
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl7
2 files changed, 8 insertions, 2 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl
index 1b7ae06888..3d0884bbe8 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl
@@ -9,10 +9,13 @@
uniform sampler2D diffuseMap;
+varying vec4 post_pos;
void main()
{
//gl_FragColor = vec4(1,1,1,gl_Color.a * texture2D(diffuseMap, gl_TexCoord[0].xy).a);
gl_FragColor = vec4(1,1,1,1);
+
+ gl_FragDepth = max(post_pos.z/post_pos.w*0.5+0.5, 0.0);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl
index cf6579a40d..3460f40657 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl
@@ -11,6 +11,8 @@ mat4 getSkinnedTransform();
attribute vec4 weight;
+varying vec4 post_pos;
+
void main()
{
gl_TexCoord[0] = gl_MultiTexCoord0;
@@ -30,8 +32,9 @@ void main()
norm = normalize(norm);
pos = gl_ProjectionMatrix * pos;
- pos.z = max(pos.z, -pos.w+0.01);
- gl_Position = pos;
+ post_pos = pos;
+
+ gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w);
gl_FrontColor = gl_Color;
}