From ea8f17368def0b581efcc332d057c0a034d4da9b Mon Sep 17 00:00:00 2001 From: krolxon Date: Sun, 11 Jan 2026 19:18:06 +0530 Subject: add shader script and keybinds --- .config/hypr/shaders/09_pixelated.glsl | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 .config/hypr/shaders/09_pixelated.glsl (limited to '.config/hypr/shaders/09_pixelated.glsl') diff --git a/.config/hypr/shaders/09_pixelated.glsl b/.config/hypr/shaders/09_pixelated.glsl new file mode 100755 index 0000000..7425135 --- /dev/null +++ b/.config/hypr/shaders/09_pixelated.glsl @@ -0,0 +1,28 @@ +#version 300 es +// Pixelation Shader - OPTIMIZED +// Fixes: Sample from pixel CENTER (not corner), aspect ratio support + +precision highp float; + +in vec2 v_texcoord; +uniform sampler2D tex; +out vec4 fragColor; + +// --- CONFIGURATION --- +// Pixels across the shorter dimension (height usually) +const float PIXEL_COUNT = 350.0; +// Set to your aspect ratio, or 1.0 for square pixels +const float ASPECT_RATIO = 16.0 / 9.0; + +void main() { + // Calculate pixel dimensions accounting for aspect ratio + vec2 pixelCount = vec2(PIXEL_COUNT * ASPECT_RATIO, PIXEL_COUNT); + vec2 pixelSize = 1.0 / pixelCount; + + // FIXED: Sample from pixel CENTER, not corner + // This prevents the "swimming" artifact when content moves + vec2 pixelCoord = floor(v_texcoord * pixelCount) + 0.5; + vec2 sampleCoord = pixelCoord / pixelCount; + + fragColor = texture(tex, sampleCoord); +} -- cgit v1.2.3