Daylight Behind the Gauze
This one didn't compile in your browser.
Sourcelayered sinusoidal curtain folds with pseudo-normal translucency, blurred window-mullion backlight and hanging-weighted wind sway
precision mediump float;
uniform vec2 u_resolution;
uniform float u_time;
float hash(vec2 p){return fract(sin(dot(p,vec2(127.1,311.7)))*43758.5453);}
float noise(vec2 p){
vec2 i=floor(p);vec2 f=fract(p);f=f*f*(3.0-2.0*f);
return mix(mix(hash(i),hash(i+vec2(1.0,0.0)),f.x),mix(hash(i+vec2(0.0,1.0)),hash(i+vec2(1.0,1.0)),f.x),f.y);
}
void main(){
vec2 uv=gl_FragCoord.xy/u_resolution;
float asp=u_resolution.x/u_resolution.y;
vec2 p=vec2(uv.x*asp,uv.y);
float t=u_time;
float hang=clamp((0.93-uv.y)/0.8,0.0,1.0);
float sway=0.06*sin(t*0.31+p.x*1.3)+0.03*sin(t*0.53+p.x*2.7+1.0);
float x=p.x+sway*hang*hang;
float ph=x*20.0+1.2*sin(x*2.3+0.7)+0.8*noise(vec2(x*1.5,t*0.05));
float ph2=x*43.0+1.7*sin(x*1.1+0.3);
float slope=cos(ph)+0.35*cos(ph2);
float trans=0.55+0.45*(1.0-abs(slope)/1.35);
vec2 wc=vec2(asp*0.6,0.58);
vec2 q=p-wc;
float win=(1.0-smoothstep(0.18,0.55,abs(q.x)))*(1.0-smoothstep(0.2,0.5,abs(q.y)));
win=mix(win,1.0-smoothstep(0.2,0.8,length(q)),0.35);
float mull=exp(-pow(q.x/0.05,2.0))+exp(-pow((q.y-0.04)/0.05,2.0));
mull=min(mull,1.0);
float cl=0.86+0.14*noise(vec2(t*0.04,3.7));
float light=win*(1.0-0.3*mull)*cl;
float lit=trans*(0.35+0.65*light);
vec3 shade=vec3(0.50,0.53,0.57);
vec3 cloth=vec3(0.82,0.79,0.72);
vec3 glow=vec3(0.97,0.91,0.80);
vec3 col=mix(shade,cloth,smoothstep(0.1,0.9,lit));
col=mix(col,glow,light*trans*0.45);
col*=0.93+0.07*clamp(slope*0.6,-1.0,1.0);
for(int i=0;i<6;i++){
float fi=float(i);
vec2 m=vec2(wc.x+0.35*sin(t*0.05+fi*2.1)+0.1*sin(fi*5.3),fract(0.1*fi*1.7+t*0.012+fi*0.37)*0.7+0.2);
float d=length(p-m);
col+=glow*0.07*smoothstep(0.03,0.0,d)*win;
}
float hemY=0.13+0.012*sin(ph)+0.008*sin(t*0.4+p.x*3.0);
float aboveHem=uv.y-hemY;
col*=1.0-0.12*smoothstep(0.035,0.0,aboveHem);
float below=smoothstep(0.006,-0.006,aboveHem);
float lx=1.0-smoothstep(0.1,0.6,abs(p.x-wc.x));
vec3 sill=vec3(0.46,0.40,0.34)*(0.78+0.3*uv.y/0.13);
sill+=glow*0.12*lx;
sill*=1.0-0.25*smoothstep(0.03,0.0,hemY-uv.y);
col=mix(col,sill,below);
float rod=smoothstep(0.925,0.935,uv.y)*(1.0-smoothstep(0.975,0.985,uv.y));
col*=1.0-0.12*smoothstep(0.88,0.93,uv.y)*(1.0-rod);
vec3 rodc=vec3(0.36,0.32,0.29)+0.08*smoothstep(0.93,0.97,uv.y);
col=mix(col,rodc,rod);
col=mix(col,vec3(0.72,0.71,0.68),smoothstep(0.98,0.995,uv.y));
col*=0.86+0.14*smoothstep(1.1,0.3,length(uv-0.5));
col=min(col,vec3(0.95));
gl_FragColor=vec4(col,1.0);
}