0/* This animation is the material of my first youtube tutorial about creative
1 coding, which is a video in which I try to introduce programmers to GLSL
2 and to the wonderful world of shaders, while also trying to share my recent
3 passion for this community.
4 Video URL: https://youtu.be/f4s1h2YETNY
5*/
7//https://iquilezles.org/articles/palettes/
8vec3 palette( float t ) {
9 vec3 a = vec3(0.5, 0.5, 0.5);
10 vec3 b = vec3(0.5, 0.5, 0.5);
11 vec3 c = vec3(1.0, 1.0, 1.0);
12 vec3 d = vec3(0.263,0.416,0.557);
14 return a + b*cos( 6.28318*(c*t+d) );
15}
17//https://www.shadertoy.com/view/mtyGWy
18void mainImage( out vec4 fragColor, in vec2 fragCoord ) {
19 vec2 uv = (fragCoord * 2.0 - iResolution.xy) / iResolution.y;
20 vec2 uv0 = uv;
21 vec3 finalColor = vec3(0.0);
23 for (float i = 0.0; i < 4.0; i++) {
24 uv = fract(uv * 1.5) - 0.5;
26 float d = length(uv) * exp(-length(uv0));
28 vec3 col = palette(length(uv0) + i*.4 + iTime*.4);
30 d = sin(d*8. + iTime)/8.;
31 d = abs(d);
33 d = pow(0.01 / d, 1.2);
35 finalColor += col * d;
36 }
38 fragColor = vec4(finalColor, 1.0);
39}
index : shaderview
Low effort shader viewer