Back to shaders

Shader test bench

Polar Flower Mandala

stronghold-curated generative glsl runnable fragment MIT
Source
runnable fragment

Complete GLSL fragment shader. Stronghold runs it directly when the browser can compile it.

Code

precision mediump float;
uniform vec2 resolution;
uniform float time;
void main(){
 vec2 uv=(gl_FragCoord.xy*2.0-resolution.xy)/min(resolution.x,resolution.y); float r=length(uv), a=atan(uv.y,uv.x);
 float petals=sin(a*10.0+time*0.6)*0.18+sin(a*17.0-time*.35)*0.08;
 float shape=smoothstep(0.018,0.0,abs(r-(0.38+petals+0.06*sin(r*24.0-time))));
 float fill=smoothstep(0.72+petals,0.08,r);
 vec3 col=0.5+0.5*cos(vec3(0.0,2.1,4.2)+a*3.0+r*9.0+time*.2);
 gl_FragColor=vec4((shape+fill*.55)*col,1.0);
}