diff options
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.glsl | 71 |
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 | |||
10 | uniform sampler2DRect depthMap; | ||
11 | uniform sampler2DRect normalMap; | ||
12 | uniform sampler2DRect lightMap; | ||
13 | |||
14 | uniform float dist_factor; | ||
15 | uniform float blur_size; | ||
16 | uniform vec2 delta; | ||
17 | uniform vec3 kern[32]; | ||
18 | uniform int kern_length; | ||
19 | uniform float kern_scale; | ||
20 | |||
21 | varying vec2 vary_fragcoord; | ||
22 | |||
23 | uniform mat4 inv_proj; | ||
24 | uniform vec2 screen_res; | ||
25 | |||
26 | vec4 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 | |||
39 | void 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 | } | ||