Heart of Sufi - Radical Ed





"In your light I learn how to love. In your beauty, how to make poems. You dance inside my chest where no-one sees you, but sometimes I do, and that sight becomes this art." Rumi

precision mediump float;

vec2 rotate(vec2 v, float a) {
float s = sin(a);
float c = cos(a);
mat2 m = mat2(c, -s, s, c);
return m * v;
}

#define MAX 10.0
#define NUM_LAYERS 4.

mat2 rot(float angle){
float s=sin(angle),c=cos(angle);
return mat2(c,-s,s,c);
}

float hash21(vec2 p){
p=fract(p*vec2(52.34,5.21));
p+=dot(p,p+45.32);
return fract(p.x*p.y);
}

float star(vec2 uv,float flare){
float d=length(uv);
float m=.04/d;
float rays=max(0.,1.-abs(uv.x*uv.y*1000.));
m+=rays*flare;
uv*=rot(3.1415/4.);
rays=max(0.,1.-abs(uv.x*uv.y*1000.));
m+=rays*.3*flare;
m*=smoothstep(1.,.2,d);
return m;
}

vec3 universe(vec2 uv){
vec3 col=vec3(0);
vec2 gv=fract(uv)-.5;
vec2 id=floor(uv);
for(int y=-1;y<=1;y++){
for(int x=-1;x<=1;x++){
vec2 offs=vec2(x,y);
float n=hash21(id+offs);// random [0,1]
float size=fract(n*354.32);
float st=star(gv-offs-vec2(n,fract(n*34.))+.5,smoothstep(.9,1.,size)*.6);
vec3 color=sin(vec3(1.3392,.2882,.0988))*.8+.5;
st*=sin(iTime*3.+n*6.2831)*.5+1.;
col+=st*size*color;
}
}
return col;
}

void mainImage( out vec4 fragColor, in vec2 fragCoord ){

int j = 0;

//vec2 p = (fragColor.xy * 2.0 - iResolution) / min(iResolution.x, iResolution.y);
vec2 p = (fragCoord.xy*2.0 - iResolution.xy) / min(iResolution.x, iResolution.y);

//p = p*0.1. ;
p = rotate (p, 1.6);

vec2 x = p + vec2(-0.3, -0.1);
float y = 1.5;
vec2 z = vec2(0.0, 0.0);

for(int i = 0; i < 360; i++){
j++;
if(length(z) > 1.0) {break;}
z = vec2(z.x * z.x - z.y * z.y, 2.0 * (sin(iTime*6.7)*0.3+1.) * z.x * z.y) + x * 0.4* y;
}

vec3 rgb = vec3(0.2,0.0,0.0);

for(float i=0.;i<1.;i+=1./NUM_LAYERS){
float depth=fract(i+iTime);
float scale=mix(20.,.5,depth);
float fade=depth*smoothstep(1.,0.9*abs(sin(iTime)),depth);
rgb+=universe(p*rot(iTime*sin(i*30.))*scale+i*453.2)*fade;
}

float t = float(j) / 130.0 ;

fragColor = vec4(rgb * t , 1.0);

}

Leave a Reply

Update cookies preferences