float circ(vec2 p){ return length(p) - .5; } // http://www.iquilezles.org/www/articles/palettes/palettes.htm // As t runs from 0 to 1 (our normalized palette index or domain), //the cosine oscilates c times with a phase of d. //The result is scaled and biased by a and b to meet the desired constrast and brightness. vec3 cosPalette( float t, vec3 a, vec3 b, vec3 c, vec3 d ) { return a + b*cos( 6.28318*(c*t+d) ); } vec3 sinPalette( float t, vec3 a, vec3 b, vec3 c, vec3 d ) { return a + b*sin( 6.28318*(c*t+d) ); } vec2 lissajous(float t, float a, float b, float del){ return vec2(sin(a*t+del),sin(b*t)); } // Repeat around the origin by a fixed angle. // For easier use, num of repetitions is use to specify the angle. float pModPolar(inout vec2 p, float repetitions) { float angle = 6.2831/repetitions; float a = atan(p.y, p.x) + angle/2.; float r = length(p); float c = floor(a/angle); a = mod(a,angle) - angle/2.; p = vec2(cos(a), sin(a))*r; return c; } void main() { gl_FragColor = vec4(black,1.); vec2 pos = uv(); pModPolar(pos, 20.0); vec2 lisa = lissajous(pos.x*20.0, 5.0*sin(time*.01), 2.0, 3.14); pos += lisa; vec3 cosp = cosPalette(time,vec3(0.5),vec3(0.5),vec3(.3),vec3(pos.x*.2,pos.y*.2,pos.x*pos.y*.2)); vec3 col = vec3(circ(pos))*cosp; // output: pixel color gl_FragColor = min(vec4( col, 1.0 ), vec4(.8)); // we take the min of the output color and a very light grey color because The Force makes // all of their controls white at the bottom all white without any sort of outline, which is // silly, so you can make it vec4(col.rgb,1.0) in other softwares or if you dont care // about seeing the controls }