summaryrefslogtreecommitdiff
path: root/src/rend2/glsl/depthblur_fp.glsl
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2013-02-15 23:46:37 +0000
committerTim Angus <tim@ngus.net>2013-02-16 21:55:58 +0000
commit1fba10104e76e937eeac60bc207a74012ab936dc (patch)
tree7bcb5507cd1aa13e6f07b74c008e9391abbf26ae /src/rend2/glsl/depthblur_fp.glsl
parentc1ad10c57be23f89f658a13729e4349b400a8734 (diff)
renderer -> renderergl1, rend2 -> renderergl2
Diffstat (limited to 'src/rend2/glsl/depthblur_fp.glsl')
-rw-r--r--src/rend2/glsl/depthblur_fp.glsl58
1 files changed, 0 insertions, 58 deletions
diff --git a/src/rend2/glsl/depthblur_fp.glsl b/src/rend2/glsl/depthblur_fp.glsl
deleted file mode 100644
index 93895b4e..00000000
--- a/src/rend2/glsl/depthblur_fp.glsl
+++ /dev/null
@@ -1,58 +0,0 @@
-uniform sampler2D u_ScreenImageMap;
-uniform sampler2D u_ScreenDepthMap;
-
-uniform vec4 u_ViewInfo; // zfar / znear, zfar
-varying vec2 var_ScreenTex;
-
-//float gauss[5] = float[5](0.30, 0.23, 0.097, 0.024, 0.0033);
-float gauss[4] = float[4](0.40, 0.24, 0.054, 0.0044);
-//float gauss[3] = float[3](0.60, 0.19, 0.0066);
-#define GAUSS_SIZE 4
-
-float getLinearDepth(sampler2D depthMap, const vec2 tex, const float zFarDivZNear)
-{
- float sampleZDivW = texture2D(depthMap, tex).r;
- return 1.0 / mix(zFarDivZNear, 1.0, sampleZDivW);
-}
-
-vec4 depthGaussian1D(sampler2D imageMap, sampler2D depthMap, vec2 tex, float zFarDivZNear, float zFar)
-{
- float scale = 1.0 / 256.0;
-
-#if defined(USE_HORIZONTAL_BLUR)
- vec2 direction = vec2(1.0, 0.0) * scale;
-#else // if defined(USE_VERTICAL_BLUR)
- vec2 direction = vec2(0.0, 1.0) * scale;
-#endif
-
- float depthCenter = zFar * getLinearDepth(depthMap, tex, zFarDivZNear);
- vec2 centerSlope = vec2(dFdx(depthCenter), dFdy(depthCenter)) / vec2(dFdx(tex.x), dFdy(tex.y));
-
- vec4 result = texture2D(imageMap, tex) * gauss[0];
- float total = gauss[0];
-
- int i, j;
- for (i = 0; i < 2; i++)
- {
- for (j = 1; j < GAUSS_SIZE; j++)
- {
- vec2 offset = direction * j;
- float depthSample = zFar * getLinearDepth(depthMap, tex + offset, zFarDivZNear);
- float depthExpected = depthCenter + dot(centerSlope, offset);
- if(abs(depthSample - depthExpected) < 5.0)
- {
- result += texture2D(imageMap, tex + offset) * gauss[j];
- total += gauss[j];
- }
- }
-
- direction = -direction;
- }
-
- return result / total;
-}
-
-void main()
-{
- gl_FragColor = depthGaussian1D(u_ScreenImageMap, u_ScreenDepthMap, var_ScreenTex, u_ViewInfo.x, u_ViewInfo.y);
-}