aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaF.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaF.glsl')
-rw-r--r--linden/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaF.glsl77
1 files changed, 77 insertions, 0 deletions
diff --git a/linden/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaF.glsl b/linden/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaF.glsl
new file mode 100644
index 0000000..fe83c3c
--- /dev/null
+++ b/linden/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaF.glsl
@@ -0,0 +1,77 @@
1/**
2 * @file avatarAlphaF.glsl
3 *
4 * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
5 * $License$
6 */
7
8uniform sampler2D diffuseMap;
9uniform sampler2DRectShadow shadowMap0;
10uniform sampler2DRectShadow shadowMap1;
11uniform sampler2DRectShadow shadowMap2;
12uniform sampler2DRectShadow shadowMap3;
13uniform sampler2D noiseMap;
14
15uniform mat4 shadow_matrix[6];
16uniform vec4 shadow_clip;
17uniform vec2 screen_res;
18
19vec3 atmosLighting(vec3 light);
20vec3 scaleSoftClip(vec3 light);
21
22varying vec3 vary_ambient;
23varying vec3 vary_directional;
24varying vec4 vary_position;
25varying vec3 vary_normal;
26
27void main()
28{
29 float shadow = 1.0;
30 vec4 pos = vary_position;
31 vec3 norm = normalize(vary_normal);
32
33 vec3 nz = texture2D(noiseMap, gl_FragCoord.xy/128.0).xyz;
34
35 vec4 spos = pos;
36
37 if (spos.z > -shadow_clip.w)
38 {
39 vec4 lpos;
40
41 if (spos.z < -shadow_clip.z)
42 {
43 lpos = shadow_matrix[3]*spos;
44 lpos.xy *= screen_res;
45 shadow = shadow2DRectProj(shadowMap3, lpos).x;
46 shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0);
47 }
48 else if (spos.z < -shadow_clip.y)
49 {
50 lpos = shadow_matrix[2]*spos;
51 lpos.xy *= screen_res;
52 shadow = shadow2DRectProj(shadowMap2, lpos).x;
53 }
54 else if (spos.z < -shadow_clip.x)
55 {
56 lpos = shadow_matrix[1]*spos;
57 lpos.xy *= screen_res;
58 shadow = shadow2DRectProj(shadowMap1, lpos).x;
59 }
60 else
61 {
62 lpos = shadow_matrix[0]*spos;
63 lpos.xy *= screen_res;
64 shadow = shadow2DRectProj(shadowMap0, lpos).x;
65 }
66 }
67
68
69 vec4 col = vec4(vary_ambient + vary_directional*shadow, gl_Color.a);
70 vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy) * col;
71
72 color.rgb = atmosLighting(color.rgb);
73
74 color.rgb = scaleSoftClip(color.rgb);
75
76 gl_FragColor = color;
77}