Files
nixos/modules/desktop/shaders/rainbow.frag
T
2026-10-02 02:06:46 +02:00

26 lines
676 B
GLSL

//modified version of [this shader](https://github.com/wessles/GLSL-CRT/blob/master/shader.frag)
#version 300 es
precision mediump float;
in vec2 v_texcoord;
uniform sampler2D tex;
out vec4 FragColor;
const float scaleFactor = 0.7;
float clamp(float x, float min, float max) {
if (x > max) return max;
if (x < min) return min;
return x;
}
// [0,1]
void main() {
vec4 cta = texture(tex, v_texcoord);
// cta += vec4(cos(v_texcoord.x)/4., sin(v_texcoord.y)/4., 0., 1.);
cta += vec4(cos(v_texcoord.x)/4., cos(v_texcoord.y)/8., sin(v_texcoord.y)/4., 1.);
FragColor = vec4(clamp(cta.x, 0., 1.), clamp(cta.y, 0., 1.), clamp(cta.z, 0., 1.), clamp(cta.w, 0., 1.));
}