123456789101112131415161718192021222324 |
- #version 430
- layout (binding = 0) uniform sampler2D depthSamp;
- in vec2 varTex;
- out vec2 color;
- void main(void) {
- vec2 sum = vec2(0.0, 0.0);
- vec2 texelSize = 1.0 / vec2(textureSize(depthSamp, 0));
- const int radius = 4;
- for(int x = -radius; x < radius; x++) {
- for(int y = -radius; y < radius; y++) {
- vec2 offset = vec2(x, y) * texelSize;
- float depth = texture(depthSamp, varTex + offset).r;
- sum += vec2(depth, depth * depth);
- }
- }
- sum /= (radius * radius * 4);
- color = sum;
- }
|