// Author: Francisco Samayoa // Title: Week 1 - Experiment 1 #ifdef GL_ES precision mediump float; #endif uniform vec2 u_resolution; uniform vec2 u_mouse; uniform float u_time; void main() { vec2 st = gl_FragCoord.xy/u_resolution.xy; st.x *= u_resolution.x/u_resolution.y; vec3 colorA = vec3(0.930,0.373,0.248); vec3 colorB = vec3(0.960,0.651,0.138); vec3 colorC = vec3(0.940,0.244,0.235); vec3 colorD = vec3(1.000,0.514,0.190); vec3 mixAB = mix(colorA, colorB, smoothstep(0.25, 0.75, st.y)); vec3 mixCD = mix(colorC, colorD, smoothstep(0.25, 0.75, st.y)); vec3 gradient = mix(mixAB, mixCD, smoothstep(0.25, 0.75, st.x)); //gradient = vec3(st.x,st.y,abs(sin(u_time))); gl_FragColor = vec4(gradient, 1.0); }
// Author: Francisco Samayoa // Title: Week 1 - Experiment 2 #ifdef GL_ES precision mediump float; #endif uniform vec2 u_resolution; uniform vec2 u_mouse; uniform float u_time; #define PI 3.1415926535 // Function from Iñigo Quiles // https://www.shadertoy.com/view/MsS3Wc vec3 hsb2rgb( in vec3 c ){ vec3 rgb = clamp(abs(mod(c.x*6.0+vec3(0.0,4.0,2.0), 6.0)-3.0)-1.0, 0.0, 1.0 ); rgb = rgb*rgb*(3.0-2.0*rgb); return c.z * mix(vec3(1.0), rgb, c.y); } void main() { vec2 st = gl_FragCoord.xy/u_resolution.xy; st.x *= u_resolution.x/u_resolution.y; vec3 hsb; hsb.r = st.x; // animate hue with time hsb.g = 1.; // saturation hsb.b = 1.; // brightness // distanced based hue float d = distance( st, vec2(0.50,0.500))*0.105; hsb.r = d; // animate hue over time hsb.r = sin(u_time*PI*0.2+d); vec3 color1 = hsb2rgb( vec3(sin(u_time) *+ d * -4., 4., 1.)); vec3 color2 = color1 * hsb2rgb( vec3(cos(u_time)* st.x * 1., st.y, 1.)); vec3 color3 = color2 * ( vec3(sin(u_time)* st.x * -1., st.y, 1.)); gl_FragColor = vec4(color3,1.0); }
// Author: Francisco Samayoa // Title: Week 1 - Experiment 3 #ifdef GL_ES precision mediump float; #endif uniform vec2 u_resolution; uniform vec2 u_mouse; uniform float u_time; // Function from Iñigo Quiles // https://www.shadertoy.com/view/MsS3Wc vec3 hsb2rgb( in vec3 c ){ vec3 rgb = clamp(abs(mod(c.x*6.0+vec3(0.0,4.0,2.0), 6.0)-3.0)-1.0, 0.0, 1.0 ); rgb = rgb*rgb*(3.0-2.0*rgb); return c.z * mix( vec3(1.0), rgb, c.y); } void main() { vec2 st = gl_FragCoord.xy/u_resolution.xy; vec3 hsb = vec3(1., 1., 1.); vec3 hsb2 = vec3(-1., 1., 1.); vec2 origin = vec2(sin(u_time), cos(u_resolution)); float d = distance(st/2.0, origin)*0.5; d = d + pow(st.x, st.y); hsb.r = d; vec2 origin2 = vec2(cos(u_time)+1., sin(u_time)-1.); float d2 = distance(st/3.384, origin)*2.; d2 = d2 + pow(st.y, st.x); hsb.r = d2; //color = vec3(st.x,st.y,abs(sin(u_time))); vec4 color = vec4(hsb2rgb(hsb), 1.0); vec4 color2 = vec4(hsb2rgb(hsb2), 1.0); gl_FragColor = mix(color, mix(color, color2, origin.y), origin.x); }