aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl')
-rw-r--r--linden/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl107
1 files changed, 0 insertions, 107 deletions
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl
deleted file mode 100644
index 3556c7b..0000000
--- a/linden/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl
+++ /dev/null
@@ -1,107 +0,0 @@
1/**
2 * @file postgiF.glsl
3 *
4 * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
5 * $License$
6 */
7
8uniform sampler2D diffuseGIMap;
9uniform sampler2D normalGIMap;
10uniform sampler2D depthGIMap;
11uniform sampler2D diffuseMap;
12
13uniform sampler2D lastDiffuseGIMap;
14uniform sampler2D lastNormalGIMap;
15uniform sampler2D lastMinpGIMap;
16uniform sampler2D lastMaxpGIMap;
17
18uniform float gi_blend;
19
20uniform mat4 gi_mat; //gPipeline.mGIMatrix - eye space to sun space
21uniform mat4 gi_mat_proj; //gPipeline.mGIMatrixProj - eye space to projected sun space
22uniform mat4 gi_norm_mat; //gPipeline.mGINormalMatrix - eye space normal to sun space normal matrix
23uniform mat4 gi_inv_proj; //gPipeline.mGIInvProj - projected sun space to sun space
24uniform float gi_radius;
25uniform float gi_intensity;
26uniform vec2 gi_kern[16];
27uniform vec2 gi_scale;
28
29
30vec4 getGIPosition(vec2 gi_tc)
31{
32 float depth = texture2D(depthGIMap, gi_tc).a;
33 vec2 sc = gi_tc*2.0;
34 sc -= vec2(1.0, 1.0);
35 vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
36 vec4 pos = gi_inv_proj*ndc;
37 pos.xyz /= pos.w;
38 pos.w = 1.0;
39 return pos;
40}
41
42
43void main()
44{
45 vec2 c_tc = gl_TexCoord[0].xy;
46
47 vec3 diff = vec3(0,0,0);
48 vec3 minp = vec3(1024,1024,1024);
49 vec3 maxp = vec3(-1024,-1024,-1024);
50 vec3 norm = vec3(0,0,0);
51
52 float dweight = 0.0;
53
54 vec3 cnorm = normalize(texture2D(normalGIMap, c_tc).rgb*2.0-1.0);
55
56 vec3 cpos = vec3(0,0,0);
57 float tweight = 0.0;
58
59 for (int i = 0; i < 8; ++i)
60 {
61 for (int j = 0; j < 8; ++j)
62 {
63 vec2 tc = vec2(i-4+0.5, j-4+0.5);
64 float weight = 1.0-length(tc)/6.0;
65 tc *= 1.0/(256.0);
66 tc += c_tc;
67
68 vec3 n = texture2D(normalGIMap, tc).rgb*2.0-1.0;
69 tweight += weight;
70
71 diff += weight*texture2D(diffuseGIMap, tc).rgb;
72
73 norm += n*weight;
74
75 dweight += dot(n, cnorm);
76
77 vec3 pos = getGIPosition(tc).xyz;
78 cpos += pos*weight;
79
80 minp = min(pos, minp);
81 maxp = max(pos, maxp);
82 }
83 }
84
85 dweight = abs(1.0-dweight/64.0);
86 float mind = min(sqrt(dweight+0.5), 1.0);
87
88 dweight *= dweight;
89
90 cpos /= tweight;
91
92 diff = clamp(diff/tweight, vec3(1.0/2.2), vec3(1,1,1));
93 norm = normalize(norm);
94 maxp = cpos;
95 minp = vec3(dweight, mind, cpos.z-minp.z);
96
97 //float blend = 1.0;
98 //diff = mix(texture2D(lastDiffuseGIMap, c_tc).rgb, diff, blend);
99 //norm = mix(texture2D(lastNormalGIMap, c_tc).rgb, norm, blend);
100 //maxp = mix(texture2D(lastMaxpGIMap, c_tc).rgb, maxp, blend);
101 //minp = mix(texture2D(lastMinpGIMap, c_tc).rgb, minp, blend);
102
103 gl_FragData[0].rgb = diff;
104 gl_FragData[2].xyz = normalize(norm);
105 gl_FragData[1].xyz = maxp;
106 gl_FragData[3].xyz = minp;
107}