// Author @patriciogv - 2015 // http://patriciogonzalezvivo.com #ifdef GL_ES precision mediump float; #endif #define PI 3.14159265359 #define TWO_PI 6.28318530718 uniform vec2 u_resolution; uniform vec2 u_mouse; uniform float u_time; float shape(vec2 st, int N){ st = st *2.-1.; float a = atan(st.x,st.y)+PI; float r = TWO_PI/float(N); return cos(floor(.5+a/r)*r-a)*length(st); } void main(){ vec2 st = gl_FragCoord.xy/u_resolution.xy; st.x *= u_resolution.x/u_resolution.y; vec3 color = vec3(0.0); float d = 0.0; d = min(shape(st,3),shape(st+vec2(0.,0.2),4)); gl_FragColor = vec4(vec3(1.0-smoothstep(.2,.25,d)),1.0); }