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/09_pixelated.glsl | |
| parent | 4c31a041975718cc2fb933012a303cf457475ce7 (diff) | |
add shader script and keybinds
Diffstat (limited to '.config/hypr/shaders/09_pixelated.glsl')
| -rwxr-xr-x | .config/hypr/shaders/09_pixelated.glsl | 28 |
1 files changed, 28 insertions, 0 deletions
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); +} |
