diff options
| author | Erik Reider <[email protected]> | 2023-04-17 23:24:48 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-04-17 23:24:48 +0200 |
| commit | cbfb7af7fd4728f993124e81f8666a2e8cee6085 (patch) | |
| tree | 081e51028d59da49480be6bff9c580bbdadca9cd /sway/desktop/fx_renderer/shaders/blur2.frag | |
| parent | 7d774f769cec2faec25d01120b05589a34b4eb0b (diff) | |
Add kawase blur (#120)
Co-authored-by: Erik Reider <[email protected]>
Co-authored-by: Will McKinnon <[email protected]>
Diffstat (limited to 'sway/desktop/fx_renderer/shaders/blur2.frag')
| -rw-r--r-- | sway/desktop/fx_renderer/shaders/blur2.frag | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/sway/desktop/fx_renderer/shaders/blur2.frag b/sway/desktop/fx_renderer/shaders/blur2.frag new file mode 100644 index 00000000..3755a294 --- /dev/null +++ b/sway/desktop/fx_renderer/shaders/blur2.frag @@ -0,0 +1,22 @@ +precision mediump float; +varying mediump vec2 v_texcoord; +uniform sampler2D tex; + +uniform float radius; +uniform vec2 halfpixel; + +void main() { + vec2 uv = v_texcoord / 2.0; + + vec4 sum = texture2D(tex, uv + vec2(-halfpixel.x * 2.0, 0.0) * radius); + + sum += texture2D(tex, uv + vec2(-halfpixel.x, halfpixel.y) * radius) * 2.0; + sum += texture2D(tex, uv + vec2(0.0, halfpixel.y * 2.0) * radius); + sum += texture2D(tex, uv + vec2(halfpixel.x, halfpixel.y) * radius) * 2.0; + sum += texture2D(tex, uv + vec2(halfpixel.x * 2.0, 0.0) * radius); + sum += texture2D(tex, uv + vec2(halfpixel.x, -halfpixel.y) * radius) * 2.0; + sum += texture2D(tex, uv + vec2(0.0, -halfpixel.y * 2.0) * radius); + sum += texture2D(tex, uv + vec2(-halfpixel.x, -halfpixel.y) * radius) * 2.0; + + gl_FragColor = sum / 12.0; +} |
