From e7c71b267557c30aa2bbe89e9a6389aa30ac4f62 Mon Sep 17 00:00:00 2001 From: tekki Date: Thu, 23 Apr 2026 21:19:20 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20blur,=20sharpen,=20sepia,=20noise=20sha?= =?UTF-8?q?der=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/hypr/shaders/blur.glsl | 23 +++++++++++++++++++++++ config/hypr/shaders/noise.glsl | 19 +++++++++++++++++++ config/hypr/shaders/sepia.glsl | 16 ++++++++++++++++ config/hypr/shaders/sharpen.glsl | 18 ++++++++++++++++++ 4 files changed, 76 insertions(+) create mode 100644 config/hypr/shaders/blur.glsl create mode 100644 config/hypr/shaders/noise.glsl create mode 100644 config/hypr/shaders/sepia.glsl create mode 100644 config/hypr/shaders/sharpen.glsl diff --git a/config/hypr/shaders/blur.glsl b/config/hypr/shaders/blur.glsl new file mode 100644 index 0000000..2c42ac8 --- /dev/null +++ b/config/hypr/shaders/blur.glsl @@ -0,0 +1,23 @@ +#version 300 es +precision highp float; + +in vec2 v_texcoord; +uniform sampler2D tex; +out vec4 fragColor; + +void main() { + float o = 0.003; + + vec4 c = vec4(0.0); + c += texture(tex, v_texcoord + vec2(-o, -o)) * 0.0625; + c += texture(tex, v_texcoord + vec2( 0, -o)) * 0.125; + c += texture(tex, v_texcoord + vec2( o, -o)) * 0.0625; + c += texture(tex, v_texcoord + vec2(-o, 0)) * 0.125; + c += texture(tex, v_texcoord ) * 0.25; + c += texture(tex, v_texcoord + vec2( o, 0)) * 0.125; + c += texture(tex, v_texcoord + vec2(-o, o)) * 0.0625; + c += texture(tex, v_texcoord + vec2( 0, o)) * 0.125; + c += texture(tex, v_texcoord + vec2( o, o)) * 0.0625; + + fragColor = c; +} diff --git a/config/hypr/shaders/noise.glsl b/config/hypr/shaders/noise.glsl new file mode 100644 index 0000000..536d986 --- /dev/null +++ b/config/hypr/shaders/noise.glsl @@ -0,0 +1,19 @@ +#version 300 es +precision highp float; + +in vec2 v_texcoord; +uniform sampler2D tex; +out vec4 fragColor; + +float rand(vec2 co) { + return fract(sin(dot(co, vec2(12.9898, 78.233))) * 43758.5453); +} + +void main() { + vec4 c = texture(tex, v_texcoord); + + float grain = rand(v_texcoord) * 0.08 - 0.04; + c.rgb += grain; + + fragColor = clamp(c, 0.0, 1.0); +} diff --git a/config/hypr/shaders/sepia.glsl b/config/hypr/shaders/sepia.glsl new file mode 100644 index 0000000..9d44f19 --- /dev/null +++ b/config/hypr/shaders/sepia.glsl @@ -0,0 +1,16 @@ +#version 300 es +precision highp float; + +in vec2 v_texcoord; +uniform sampler2D tex; +out vec4 fragColor; + +void main() { + vec4 c = texture(tex, v_texcoord); + + float r = dot(c.rgb, vec3(0.393, 0.769, 0.189)); + float g = dot(c.rgb, vec3(0.349, 0.686, 0.168)); + float b = dot(c.rgb, vec3(0.272, 0.534, 0.131)); + + fragColor = vec4(clamp(r, 0.0, 1.0), clamp(g, 0.0, 1.0), clamp(b, 0.0, 1.0), c.a); +} diff --git a/config/hypr/shaders/sharpen.glsl b/config/hypr/shaders/sharpen.glsl new file mode 100644 index 0000000..4b5dee1 --- /dev/null +++ b/config/hypr/shaders/sharpen.glsl @@ -0,0 +1,18 @@ +#version 300 es +precision highp float; + +in vec2 v_texcoord; +uniform sampler2D tex; +out vec4 fragColor; + +void main() { + float o = 0.002; + + vec4 c = texture(tex, v_texcoord) * 5.0; + c -= texture(tex, v_texcoord + vec2( 0, -o)); + c -= texture(tex, v_texcoord + vec2(-o, 0)); + c -= texture(tex, v_texcoord + vec2( o, 0)); + c -= texture(tex, v_texcoord + vec2( 0, o)); + + fragColor = clamp(c, 0.0, 1.0); +}