Skip to content

Commit c0bf7e5

Browse files
committed
Frag shader 004PunchDrunk.
1 parent 49d2eaf commit c0bf7e5

File tree

4 files changed

+76
-2
lines changed

4 files changed

+76
-2
lines changed
File renamed without changes.

frag/004PunchDrunk.glsl

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
precision mediump float;
2+
3+
uniform vec2 iResolution;
4+
uniform float iTime;
5+
uniform vec2 iMouse;
6+
7+
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
8+
vec2 uv = fragCoord / iResolution.xy;
9+
10+
// Create two fractionings of coordinate space
11+
vec2 uv1 = fract(uv * 3.);
12+
vec2 uv2 = fract((uv - 0.5) * 10. * sin(0.5*iTime+.5)*0.5+0.5);
13+
14+
// Create 1d vertical noise lines
15+
float n1 = cos(iTime + sin(uv1.x * 90.1415) * 100.1415) * 0.5 + 0.5;
16+
17+
// Create dynamic circles and calculate fn of distance
18+
vec3 circle2 = vec3(0.5, 0.5, (iTime/3. - floor(iTime/3.)));
19+
float circDist = 1. - smoothstep(length(uv2 - circle2.xy) - circle2.z, 0.05, 0.01);
20+
21+
// Create a colourful background with dynamic x and y thresholds
22+
float ca = smoothstep(uv.x, sin(0.34*iTime), 0.9 - uv.x);
23+
float cb = smoothstep(uv.y, -cos(1.5*iTime), 0.9 - uv.y);
24+
float cc = pow(fract(iTime), uv.x + uv.y);
25+
vec3 bg = vec3(ca, cb, cc);
26+
27+
// Step and multiply to mimic conditional AND logic
28+
float p = step(0.1, circDist);
29+
p *= step(0.7, n1);
30+
fragColor = vec4(bg * p, 1.);
31+
}
32+
33+
void main() {
34+
mainImage(gl_FragColor, gl_FragCoord.xy);
35+
}

frag/dev.glsl

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
precision mediump float;
2+
3+
uniform vec2 iResolution;
4+
uniform float iTime;
5+
uniform vec2 iMouse;
6+
7+
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
8+
vec2 uv = fragCoord / iResolution.xy;
9+
10+
// // Create two fractionings of coordinate space
11+
// vec2 uv1 = fract(uv * 3.);
12+
// vec2 uv2 = fract((uv - 0.5) * 10. * sin(0.5*iTime+.5)*0.5+0.5);
13+
//
14+
// // Create 1d vertical noise lines
15+
// float n1 = cos(iTime + sin(uv1.x * 90.1415) * 100.1415) * 0.5 + 0.5;
16+
//
17+
// // Create dynamic circles and calculate fn of distance
18+
// vec3 circle2 = vec3(0.5, 0.5, (iTime/3. - floor(iTime/3.)));
19+
// float circDist = 1. - smoothstep(length(uv2 - circle2.xy) - circle2.z, 0.05, 0.01);
20+
21+
// Create a colourful background with dynamic x and y thresholds
22+
float ca = smoothstep(uv.x, sin(0.34*iTime), 0.9 - uv.x);
23+
float cb = smoothstep(uv.y, -cos(1.5*iTime), 0.9 - uv.y);
24+
float cc = pow(fract(iTime), uv.x + uv.y);
25+
vec3 bg = vec3(ca, cb, cc);
26+
fragColor = vec4(bg, 1.);
27+
28+
29+
// Step and multiply to mimic conditional AND logic
30+
// float p = step(0.1, circDist);
31+
// p *= step(0.7, n1);
32+
// fragColor = vec4(bg * p, 1.);
33+
}
34+
35+
void main() {
36+
mainImage(gl_FragColor, gl_FragCoord.xy);
37+
}

frag/manifest.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
[
22
"001GianlucaFirstShader.glsl",
33
"002GianlucaExperiment.glsl",
4-
"003.glsl",
5-
"testShader.glsl"
4+
"003PatternZoomer.glsl",
5+
"004PunchDrunk.glsl",
6+
"testShader.glsl",
7+
"dev.glsl"
68
]

0 commit comments

Comments
 (0)