diff options
| author | krolxon <krolyxon@tutanota.com> | 2026-01-11 19:18:06 +0530 |
|---|---|---|
| committer | krolxon <krolyxon@tutanota.com> | 2026-01-11 19:18:06 +0530 |
| commit | ea8f17368def0b581efcc332d057c0a034d4da9b (patch) | |
| tree | 5fd0bfd6627d34b93090d79628bdd87793e9f715 /.config/hypr/shaders/16_vignette.glsl | |
| parent | 4c31a041975718cc2fb933012a303cf457475ce7 (diff) | |
add shader script and keybinds
Diffstat (limited to '.config/hypr/shaders/16_vignette.glsl')
| -rwxr-xr-x | .config/hypr/shaders/16_vignette.glsl | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/.config/hypr/shaders/16_vignette.glsl b/.config/hypr/shaders/16_vignette.glsl new file mode 100755 index 0000000..efd838d --- /dev/null +++ b/.config/hypr/shaders/16_vignette.glsl @@ -0,0 +1,37 @@ +#version 300 es +// Vignette Shader for Hyprland +// Description: Darkens the edges of the screen to draw focus to the center. +// Uses smoothstep for a high-quality, organic falloff. + +precision highp float; + +in vec2 v_texcoord; +uniform sampler2D tex; +out vec4 fragColor; + +// --- CONFIGURATION --- +// The radius where the darkening begins (0.0 is center, 0.8 is near corners) +const float RADIUS = 0.85; +// How soft the transition is (higher = smoother gradient) +const float SOFTNESS = 0.85; +// The strength of the darkness (0.0 = no vignette, 1.0 = pitch black corners) +const float STRENGTH = 0.8; + +void main() { + // 1. Sample the original screen color + vec4 color = texture(tex, v_texcoord); + + // 2. Calculate distance from center (0.5, 0.5) + float dist = distance(v_texcoord, vec2(0.5)); + + // 3. Calculate vignette factor using smoothstep for high-quality falloff + // We invert the smoothstep range so 1.0 is center and 0.0 is edges + float vignette = smoothstep(RADIUS, RADIUS - SOFTNESS, dist); + + // 4. Apply the vignette strength + // Mix between the original color and the darkened version + // This allows us to control intensity without changing the geometry of the falloff + color.rgb = mix(color.rgb, color.rgb * vignette, STRENGTH); + + fragColor = color; +} |
