aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/app_settings/shaders/class2/deferred/blurLightF.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/app_settings/shaders/class2/deferred/blurLightF.glsl')
-rw-r--r--linden/indra/newview/app_settings/shaders/class2/deferred/blurLightF.glsl71
1 files changed, 0 insertions, 71 deletions
diff --git a/linden/indra/newview/app_settings/shaders/class2/deferred/blurLightF.glsl b/linden/indra/newview/app_settings/shaders/class2/deferred/blurLightF.glsl
deleted file mode 100644
index 1713fe9..0000000
--- a/linden/indra/newview/app_settings/shaders/class2/deferred/blurLightF.glsl
+++ /dev/null
@@ -1,71 +0,0 @@
1/**
2 * @file blurLightF.glsl
3 *
4 * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
5 * $License$
6 */
7
8#extension GL_ARB_texture_rectangle : enable
9
10uniform sampler2DRect depthMap;
11uniform sampler2DRect normalMap;
12uniform sampler2DRect lightMap;
13
14uniform float dist_factor;
15uniform float blur_size;
16uniform vec2 delta;
17uniform vec3 kern[32];
18uniform int kern_length;
19uniform float kern_scale;
20
21varying vec2 vary_fragcoord;
22
23uniform mat4 inv_proj;
24uniform vec2 screen_res;
25
26vec4 getPosition(vec2 pos_screen)
27{
28 float depth = texture2DRect(depthMap, pos_screen.xy).a;
29 vec2 sc = pos_screen.xy*2.0;
30 sc /= screen_res;
31 sc -= vec2(1.0,1.0);
32 vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
33 vec4 pos = inv_proj * ndc;
34 pos /= pos.w;
35 pos.w = 1.0;
36 return pos;
37}
38
39void main()
40{
41 vec3 norm = texture2DRect(normalMap, vary_fragcoord.xy).xyz*2.0-1.0;
42 vec3 pos = getPosition(vary_fragcoord.xy).xyz;
43 vec4 ccol = texture2DRect(lightMap, vary_fragcoord.xy).rgba;
44
45 vec2 dlt = kern_scale * delta / (1.0+norm.xy*norm.xy);
46
47 dlt /= max(-pos.z*dist_factor, 1.0);
48
49 vec2 defined_weight = kern[0].xy; // special case the first (centre) sample's weight in the blur; we have to sample it anyway so we get it for 'free'
50 vec4 col = defined_weight.xyxx * ccol;
51
52 for (int i = 1; i < kern_length; i++)
53 {
54 vec2 tc = vary_fragcoord.xy + kern[i].z*dlt;
55 vec3 samppos = getPosition(tc).xyz;
56 float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane
57 if (d*d <= 0.003)
58 {
59 col += texture2DRect(lightMap, tc)*kern[i].xyxx;
60 defined_weight += kern[i].xy;
61 }
62 }
63
64
65
66 col /= defined_weight.xyxx;
67
68 gl_FragColor = col;
69
70 //gl_FragColor = ccol;
71}