-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmatrix.frag
More file actions
executable file
·55 lines (34 loc) · 1.03 KB
/
Copy pathmatrix.frag
File metadata and controls
executable file
·55 lines (34 loc) · 1.03 KB
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
precision mediump float;
#define PI 3.14159265359
#define speed 2.
#define scale 16.
float Hash21(vec2 p) {
p = fract(p * vec2(233.34, 856.43));
p += dot(p, p + 32.57);
return fract(p.x * p.y);
}
vec3 Grid(vec2 ouv) {
vec3 col = vec3(0.);
float cols = scale;
vec2 nuv = ouv * cols + vec2(0., iTime * speed);
vec2 cell = floor(nuv);
float ratio = 1.;
float rows = cols;
rows *= clamp(.1, 1., Hash21(vec2(cell.x + 1.)));
nuv = ouv * vec2(cols, rows) + vec2(0., iTime * speed);
vec2 uv = fract(nuv);
cell = floor(nuv);
ratio = rows/cols;
uv -= .5;
uv.x *= ratio;
vec2 center = vec2(0.);
float size = Hash21(cell)*0.015 * sin(iTime*5. + cell.x + cell.y);
col += smoothstep(.0,0.99,.01 + size/distance(uv, center) * sin(vec3(0.9, 0.9, 0.9)));
return col;
}
void mainImage( out vec4 fragColor, in vec2 fragCoord ) {
vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y + .5;
vec3 col = vec3(0.);
col = Grid(uv);
fragColor = vec4(col, 1.);
}