mirror of
https://github.com/JoeyDeVries/LearnOpenGL.git
synced 2026-01-30 20:13:22 +08:00
21 lines
462 B
GLSL
21 lines
462 B
GLSL
#version 330 core
|
|
out float FragColor;
|
|
|
|
in vec2 TexCoords;
|
|
|
|
uniform sampler2D ssaoInput;
|
|
|
|
void main()
|
|
{
|
|
vec2 texelSize = 1.0 / vec2(textureSize(ssaoInput, 0));
|
|
float result = 0.0;
|
|
for (int x = -2; x < 2; ++x)
|
|
{
|
|
for (int y = -2; y < 2; ++y)
|
|
{
|
|
vec2 offset = vec2(float(x), float(y)) * texelSize;
|
|
result += texture(ssaoInput, TexCoords + offset).r;
|
|
}
|
|
}
|
|
FragColor = result / (4.0 * 4.0);
|
|
} |