SHARE
TWEET
Untitled
a guest
Dec 26th, 2014
166
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- #version 400
- in vec2 coord;
- uniform sampler2D depthMap;
- uniform vec2 screenSize;
- uniform mat4 projection;
- uniform vec2 blurDir;
- void main() {
- float depth = texture(depthMap, coord).x;
- float sum = 0.0f;
- float wsum = 0.0f;
- float filterRadius = 10;
- float blurScale = .1;
- float blurDepthFalloff = 1000;
- for (float x = -filterRadius; x <= filterRadius; x += 1.0f) {
- float s = texture(depthMap, coord + x*blurDir).x;
- float r = x * blurScale;
- float w = exp(-r*r);
- float r2 = (s - depth) * blurDepthFalloff;
- float g = exp(-r2*r2);
- sum += s * w * g;
- wsum += w * g;
- }
- if (wsum > 0.0f) {
- sum /= wsum;
- }
- gl_FragDepth = sum;
- }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

