aboutsummaryrefslogtreecommitdiff
path: root/.config/hypr/shaders/15_anaglyph_3d.glsl
diff options
context:
space:
mode:
Diffstat (limited to '.config/hypr/shaders/15_anaglyph_3d.glsl')
-rwxr-xr-x.config/hypr/shaders/15_anaglyph_3d.glsl35
1 files changed, 35 insertions, 0 deletions
diff --git a/.config/hypr/shaders/15_anaglyph_3d.glsl b/.config/hypr/shaders/15_anaglyph_3d.glsl
new file mode 100755
index 0000000..8294e31
--- /dev/null
+++ b/.config/hypr/shaders/15_anaglyph_3d.glsl
@@ -0,0 +1,35 @@
+#version 300 es
+// Anaglyph 3D Shader - OPTIMIZED
+// Fixes: Edge clamping, alpha preservation, depth-aware separation
+
+precision highp float;
+
+in vec2 v_texcoord;
+uniform sampler2D tex;
+out vec4 fragColor;
+
+// --- CONFIGURATION ---
+const float SEPARATION = 0.003;
+// Make separation stronger at edges (simulates depth from screen curvature)
+const bool DEPTH_AWARE = true;
+
+void main() {
+ vec2 offset = vec2(SEPARATION, 0.0);
+
+ // Optional: Increase separation toward screen edges for more depth
+ if (DEPTH_AWARE) {
+ float edgeFactor = abs(v_texcoord.x - 0.5) * 2.0; // 0 at center, 1 at edges
+ offset.x *= 1.0 + edgeFactor * 0.5;
+ }
+
+ // Clamp coordinates to prevent edge sampling artifacts
+ vec2 leftCoord = clamp(v_texcoord - offset, 0.0, 1.0);
+ vec2 rightCoord = clamp(v_texcoord + offset, 0.0, 1.0);
+
+ vec4 leftEye = texture(tex, leftCoord);
+ vec4 rightEye = texture(tex, rightCoord);
+ vec4 center = texture(tex, v_texcoord);
+
+ // Combine: Red from left, Cyan (GB) from right
+ fragColor = vec4(leftEye.r, rightEye.g, rightEye.b, center.a);
+}