ISF - Generators - willstall 005
#define PI 3.14159265359
#define HALF_PI 1.57079632675
#define TWO_PI 6.283185307
uniform float u_float;
uniform vec2 u_vec2;
uniform vec3 u_vec3;
uniform vec4 u_vec4;
vec3 palette(float t,vec3 a,vec3 b,vec3 c,vec3 d )
{
return a + b * cos( TWO_PI * (c*t+d));
}
mat2 rotate(float angle)
{
return mat2( cos(angle),-sin(angle),sin(angle),cos(angle) );
}
vec2 center(vec2 st)
{
float aspect = RENDERSIZE.x/RENDERSIZE.y;
st.x = st.x * aspect - aspect * 0.5 + 0.5;
return st;
}
float innerStroke(float sdf, float size)
{
size *= 0.5;
return max(sdf,-max(sdf - size, sdf-size));
}
float stroke(float sdf, float size)
{
return sdf-size;
}
void main() {
vec2 st = isf_FragNormCoord.xy;
st = center( st );
vec2 st2 = st;
st2 -= 0.5;
st2.x += TIME*0.013;
st2 *= rotate(45.0);
st2 += 0.5;
float t = TIME*rotation_speed;
vec3 color = vec3(0.1);
float p = length(st-vec2(0.5+0.14*sin(t),0.5+0.14*cos(t)));
float d1 = length(st-vec2(0.5)) - .2;
float d2 = sin(+st2.x*200.0);
float d3 = p-.2;
d1 = max(d1,-d3) + .01 * sin(TIME);
d1 = smoothstep(0.1,0.107,d1);
d1 = max(-d1,d2) + max(-d1,-d2);
d1 = smoothstep(0.1,0.5,d1);
color += d1;
vec3 c1 = vec3(0.74,0.7082,0.1);
vec3 c2 = vec3(0.69,0.68,0.16);
vec3 c3 = vec3(0.67,.87,0.206);
if(colorize_back){
color = palette((max(d1,pow(p,.85)-.1))-(TIME*colorize_speed)*PI*1.0,vec3(0.5),c1,c2,c3);
}
color += (1.0 - pow(p,.9))*(0.08+.04*abs(sin(TIME*.33)));
gl_FragColor = vec4(color, 1.0);
}