← Daily shaders~/adventure-log/shaders/2026-09-29

A Page Lifts in the Rain

A Page Lifts in the RainSteady rain falls as one page lifts through warm lamplight, small motes drifting upward. · Rain 19–21°C
Sourcetranslucent polar-wedge page fan with eased turning blade, fbm mist and soft columnar rain
2026-09-29.frag
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);
  float a=hash(i);float b=hash(i+vec2(1.0,0.0));
  float c=hash(i+vec2(0.0,1.0));float d=hash(i+vec2(1.0,1.0));
  return mix(mix(a,b,f.x),mix(c,d,f.x),f.y);
}
float fbm(vec2 p){
  float v=0.0;float a=0.5;
  for(int i=0;i<4;i++){v+=a*noise(p);p=p*2.03+vec2(1.7,9.2);a*=0.5;}
  return v;
}

void main(){
  vec2 uv=gl_FragCoord.xy/u_resolution;
  vec2 p=(gl_FragCoord.xy-0.5*u_resolution)/u_resolution.y;
  float t=u_time;
  vec3 col=mix(vec3(0.13,0.19,0.20),vec3(0.31,0.39,0.36),uv.y);
  col+=(fbm(p*2.2+vec2(t*0.015,-t*0.01))-0.5)*0.12;
  vec2 rp=vec2(p.x*22.0,p.y);
  float cx=floor(rp.x);float fx=fract(rp.x)-0.5;
  float h=hash(vec2(cx,3.1));
  float sp=0.35+0.35*h;
  float ry=fract(p.y*1.1+t*sp+h*7.0);
  float streak=smoothstep(0.4,0.0,abs(fx))*smoothstep(0.0,0.12,ry)*smoothstep(0.55,0.15,ry);
  col+=vec3(0.55,0.66,0.70)*streak*0.08*(0.4+0.6*h);
  vec2 gc=vec2(0.0,-0.08);
  float g=exp(-3.0*length(p-gc))*(0.92+0.08*sin(t*0.35));
  col+=vec3(0.95,0.62,0.28)*g*0.42;
  vec2 s=vec2(0.0,-0.36);
  vec2 d=p-s;
  float r=length(d);
  float a=atan(d.x,d.y);
  float base=smoothstep(0.0,0.04,r);
  for(int i=0;i<12;i++){
    float fi=float(i);
    float side=fi<5.5?-1.0:1.0;
    float k=mod(fi,6.0);
    float ai=side*(0.32+k*0.12);
    float w=0.075;
    float L=0.60-k*0.03+0.015*sin(fi*3.7);
    float m=smoothstep(w,w-0.03,abs(a-ai))*smoothstep(L,L-0.02,r)*base;
    float shade=mix(0.72,1.0,clamp(r/L,0.0,1.0));
    vec3 pc=vec3(0.92,0.87,0.76)*shade+vec3(0.25,0.14,0.04)*g;
    col=mix(col,pc,m*0.26);
  }
  float ph=fract(t/16.0);
  float turn=smoothstep(0.2,0.85,ph);
  float fade=smoothstep(0.0,0.12,ph)*smoothstep(1.0,0.9,ph);
  float at=mix(1.0,-1.0,turn);
  float Lt=0.58*(0.78+0.22*abs(sin(at)));
  float wt=0.08+0.03*(1.0-abs(at));
  float mt=smoothstep(wt,wt-0.03,abs(a-at))*smoothstep(Lt,Lt-0.02,r)*base;
  vec3 tc=vec3(1.0,0.90,0.72)*mix(0.8,1.05,clamp(r/Lt,0.0,1.0));
  col=mix(col,tc,mt*0.55*fade);
  float rim=smoothstep(0.03,0.0,abs(r-Lt+0.015))*smoothstep(wt,wt-0.03,abs(a-at));
  col+=vec3(1.0,0.75,0.4)*rim*0.25*fade;
  for(int i=0;i<7;i++){
    float fi=float(i);
    float life=fract(t*0.035+fi*0.143);
    vec2 mp=s+vec2(sin(fi*2.3+t*0.18)*0.32*(0.4+life),0.12+life*0.85);
    float md=length(p-mp);
    float mb=smoothstep(0.02,0.004,md)*smoothstep(0.0,0.2,life)*smoothstep(1.0,0.6,life);
    col+=vec3(1.0,0.78,0.45)*mb*0.35;
  }
  vec2 v=uv-0.5;
  col*=1.0-0.7*dot(v,v);
  col=clamp(col,0.0,0.95);
  gl_FragColor=vec4(col,1.0);
}