From 0d95b6364d23d0f014b818d5613417013298ec66 Mon Sep 17 00:00:00 2001 From: "re.kovalev" Date: Sun, 15 Jan 2023 04:49:16 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A8=D0=B5=D0=B9=D0=B4=D0=B5=D1=80=20=D1=80?= =?UTF-8?q?=D0=B0=D0=B7=D0=BC=D1=8B=D1=82=D0=B8=D1=8F=20SSAO?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shaders/ssaoBlur.frag | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 shaders/ssaoBlur.frag diff --git a/shaders/ssaoBlur.frag b/shaders/ssaoBlur.frag new file mode 100644 index 0000000..dfc9571 --- /dev/null +++ b/shaders/ssaoBlur.frag @@ -0,0 +1,23 @@ +#version 330 core + +in vec2 texCoord; + +out float occlusion; + +uniform sampler2D ssao; + +void main() +{ + vec2 texelSize = 1.0 / vec2(textureSize(ssao, 0)); + vec2 offset; + occlusion = 0.0; + for (int x = -2; x < 2; x++) + { + for (int y = -2; y < 2; y++) + { + offset = vec2(x, y) * texelSize; + occlusion += texture(ssao, texCoord + offset).r; + } + } + occlusion = occlusion / (4.0 * 4.0); +} \ No newline at end of file