-
Notifications
You must be signed in to change notification settings - Fork 0
/
FlashingGlitch.frag
57 lines (45 loc) · 1.45 KB
/
FlashingGlitch.frag
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
Flashing Glitch
*/
out vec4 fragColor;
uniform float time;
void main()
{
vec2 uv = vUV.st;
vec4 color = texture(sTD2DInputs[0], uv);
vec4 black = vec4(vec3(0.0), 1.0);
vec4 dstCol = vec4(1.0);
float noise = TDSimplexNoise(vec2(uv.y * 10.0, time * 10.0));
float threshould = 0.5;
vec2 delta = vec2(0.02);
if(noise > threshould){
color.g = texture(sTD2DInputs[0], fract(uv - delta)).g;
color.b = texture(sTD2DInputs[0], fract(uv + delta)).b;
}
float t = time * 1.0;
if(fract(t*2.0) > 0.6){
//dstCol.rgb = vec3(1.0) - color.rgb;
dstCol = black;
//for wave
float ny = uv.y + TDSimplexNoise(vec3(uv.x* 100.00, uv.y* 100.0, time*10.0));
noise = TDSimplexNoise(vec2(ny, time * 10.0));
if(noise > 0.2){
dstCol += texture(sTD2DInputs[0], fract(uv + delta));
//dstCol.b += texture(sTD2DInputs[0], fract(uv + delta)).b;
//dstCol.g += texture(sTD2DInputs[0], fract(uv + delta)).g;
}
}else if(fract(t*2.0) > 0.3 && fract(time*2.0) < 0.6){
dstCol.rgb = vec3(1.0) - color.rgb;
//for wave
float ny = uv.y + TDSimplexNoise(vec3(uv.x* 100.00, uv.y* 100.0, time*10.0));
noise = TDSimplexNoise(vec2(ny, time * 10.0));
if(noise > 0.2){
dstCol.r += texture(sTD2DInputs[0], fract(uv - delta)).r;
dstCol.b += texture(sTD2DInputs[0], fract(uv + delta)).b;
}
}
else{
dstCol = color;
}
fragColor = TDOutputSwizzle(dstCol);
}