Modern Apps git
git clone https://git.maproj.org/Modern-Apps.git
translate ▾

Modern-Apps.git / games / voxels / src / main / rust / shaders / blur.frag

blur.frag18 lines · 690 BRaw
1#version 450
2// Separable 5-tap Gaussian blur. `pc.param.xy` = uv step along the blur axis.
3layout(location=0) in vec2 vUv;
4layout(binding=0) uniform sampler2D src;
5layout(binding=1) uniform sampler2D unused;
6layout(push_constant) uniform PC { vec4 param; } pc;
7layout(location=0) out vec4 outColor;
8void main() {
9 vec2 d = pc.param.xy;
10 vec3 s = texture(src, vUv).rgb * 0.227027;
11 vec2 o1 = d * 1.3846153846;
12 vec2 o2 = d * 3.2307692308;
13 s += texture(src, vUv + o1).rgb * 0.3162162162;
14 s += texture(src, vUv - o1).rgb * 0.3162162162;
15 s += texture(src, vUv + o2).rgb * 0.0702702703;
16 s += texture(src, vUv - o2).rgb * 0.0702702703;
17 outColor = vec4(s, 1.0);
18}