Files
armorpaint/base/shaders/ssr_blur_pass.frag.glsl
T
2024-10-02 23:17:50 +02:00

26 lines
729 B
GLSL

#version 450
uniform sampler2D tex;
uniform sampler2D gbuffer0;
uniform vec2 dir_inv;
#include "std/gbuffer.glsl"
in vec2 tex_coord;
out vec4 frag_color;
void main() {
float roughness = textureLod(gbuffer0, tex_coord, 0.0).b;
if (roughness >= 0.8) { // No reflections
frag_color.rgb = textureLod(tex, tex_coord, 0.0).rgb;
return;
}
frag_color.rgb = textureLod(tex, tex_coord + dir_inv * 2.5, 0.0).rgb;
frag_color.rgb += textureLod(tex, tex_coord + dir_inv * 1.5, 0.0).rgb;
frag_color.rgb += textureLod(tex, tex_coord, 0.0).rgb;
frag_color.rgb += textureLod(tex, tex_coord - dir_inv * 1.5, 0.0).rgb;
frag_color.rgb += textureLod(tex, tex_coord - dir_inv * 2.5, 0.0).rgb;
frag_color.rgb /= vec3(5.0, 5.0, 5.0);
}