ssaoBlur.fs 514 B

1234567891011121314151617181920
  1. #version 430
  2. layout (binding = 0) uniform sampler2D ssaoSamp;
  3. in vec2 varTex;
  4. out float color;
  5. void main() {
  6. vec2 texelSize = 1.0 / vec2(textureSize(ssaoSamp, 0));
  7. float result = 0.0;
  8. const int radius = 2;
  9. for(int x = -radius; x < radius; x++) {
  10. for(int y = -radius; y < radius; y++) {
  11. vec2 offset = vec2(float(x), float(y)) * texelSize;
  12. result += texture(ssaoSamp, varTex + offset).r;
  13. }
  14. }
  15. result /= (radius * radius * 4);
  16. color = result;
  17. }