diff options
Diffstat (limited to '.config/hypr/shaders/drugs.frag')
-rw-r--r-- | .config/hypr/shaders/drugs.frag | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/.config/hypr/shaders/drugs.frag b/.config/hypr/shaders/drugs.frag new file mode 100644 index 0000000..1190ed0 --- /dev/null +++ b/.config/hypr/shaders/drugs.frag | |||
@@ -0,0 +1,42 @@ | |||
1 | |||
2 | precision highp float; | ||
3 | varying vec2 v_texcoord; | ||
4 | uniform sampler2D tex; | ||
5 | uniform float time; | ||
6 | |||
7 | void warpco(inout vec2 tc) { | ||
8 | tc -= 0.5; | ||
9 | tc *= length(tc) * 2.0; | ||
10 | tc += 0.5; | ||
11 | } | ||
12 | |||
13 | float rand1d(float seed) { | ||
14 | return sin(seed*1454.0); | ||
15 | } | ||
16 | |||
17 | float rand2d(vec2 co) | ||
18 | { | ||
19 | return fract(sin(dot(co.xy, vec2(12.9898,78.233))) * 43758.5453); | ||
20 | } | ||
21 | |||
22 | vec3 rgb(in vec2 tc, float freq, float amp, inout vec4 centre) { | ||
23 | vec2 off = vec2(1.0/800.0, 0.0) * sin(tc.t * freq + time) * amp; | ||
24 | vec2 off2 = vec2(1.0/800.0, 0.0) * sin(tc.t * freq - time * 1.5) * amp; | ||
25 | centre = texture2D(tex, tc); | ||
26 | return vec3(texture2D(tex, tc-off).r, centre.g, texture2D(tex, tc+off2).b); | ||
27 | } | ||
28 | |||
29 | void main() { | ||
30 | // vec2 px = 1.0 / textureSize(tex, 0).st; | ||
31 | vec2 tc = v_texcoord; | ||
32 | warpco(tc); | ||
33 | tc = mix(v_texcoord, tc, sin(time * 2.0)*0.07); | ||
34 | tc.x += rand2d(floor(tc * 20.0 + floor(time * 2.5))) * 0.01; | ||
35 | tc.x += rand1d(floor(tc.x * 40.0)) * 0.005 * rand1d(time * 0.001); | ||
36 | tc.y += sin(tc.x + time) * 0.02; | ||
37 | vec4 centre; | ||
38 | vec3 bent = rgb(tc, 100.0, 5.0, centre); | ||
39 | vec3 col = mix(centre.rgb, bent, sin(time)); | ||
40 | gl_FragColor = vec4(col, centre.a); | ||
41 | // gl_FragColor = vec4(texture2D(tex, v_texcoord)); | ||
42 | } \ No newline at end of file | ||