← 毎日のシェーダー~/adventure-log/shaders/2026-10-05

朝さんぽの拍子

朝さんぽの拍子薄曇りの下、重なる稜線がゆっくり流れ、温かな光が一歩ずつ奥へ灯ってゆく。 · くもり 17–22°C
ソースparallax sine-noise ridge silhouettes with atmospheric perspective, sequenced footstep light pulses, wind-drifting rotating leaf ellipses
2026-10-05.frag
precision mediump float;
uniform vec2 u_resolution;
uniform float u_time;

float hash(float n){return fract(sin(n)*43758.5453);}
float noise(float x){
  float i=floor(x);float f=fract(x);
  f=f*f*(3.0-2.0*f);
  return mix(hash(i),hash(i+1.0),f);
}

void main(){
  vec2 uv=gl_FragCoord.xy/u_resolution.xy;
  float asp=u_resolution.x/u_resolution.y;
  vec2 p=vec2(uv.x*asp,uv.y);
  float t=u_time;

  vec3 skyTop=vec3(0.70,0.74,0.78);
  vec3 skyLow=vec3(0.88,0.86,0.81);
  vec3 col=mix(skyLow,skyTop,smoothstep(0.4,1.0,uv.y));
  float glow=exp(-length((p-vec2(asp*0.7,0.84))*vec2(1.0,1.6))*3.0);
  col+=vec3(0.10,0.08,0.04)*glow*(0.85+0.15*sin(t*0.2));
  float cb=noise(p.x*1.5+t*0.03)*0.5+noise(p.x*3.0+uv.y*4.0-t*0.05)*0.5;
  col=mix(col,vec3(0.80,0.81,0.84),smoothstep(0.55,0.95,uv.y)*cb*0.35);

  for(int i=0;i<5;i++){
    float fi=float(i);
    float depth=fi/4.0;
    float x=p.x+t*(0.008+0.018*fi)+fi*3.7;
    float h=0.64-fi*0.115+0.055*sin(x*(1.2+fi*0.4)+fi)+0.05*noise(x*2.2+fi*10.0);
    float edge=smoothstep(h+0.007,h-0.007,uv.y);
    vec3 c=mix(vec3(0.68,0.72,0.74),vec3(0.40,0.40,0.30),depth);
    c=mix(c,vec3(0.64,0.40,0.22),0.4*depth*noise(x*2.5+fi*5.0));
    c*=1.0-0.12*smoothstep(h,h-0.15,uv.y);
    float mist=(1.0-depth)*0.25*smoothstep(h-0.2,h,uv.y);
    c=mix(c,skyLow,mist);
    col=mix(col,c,edge);
  }

  float head=fract(t*0.07);
  for(int k=0;k<12;k++){
    float fk=float(k);
    float s=fk/11.0;
    vec2 c=vec2(mix(0.12,0.85,s)*asp,0.06+0.10*s+0.015*sin(s*7.0+1.0));
    float side=mod(fk,2.0)*2.0-1.0;
    c.y+=side*0.012*(1.0-0.5*s);
    float sz=0.017*(1.0-0.45*s);
    vec2 q=p-c;
    float e=length(vec2(q.x/1.5,q.y))/sz;
    float age=fract(head-s*0.6);
    float b=smoothstep(0.0,0.04,age)*exp(-age*3.5);
    col+=vec3(0.16,0.11,0.05)*exp(-e*e*0.25)*b*0.35;
    col=mix(col,vec3(0.98,0.88,0.66),smoothstep(1.0,0.6,e)*b*0.85);
  }

  for(int j=0;j<6;j++){
    float fj=float(j);
    float ph=fract(hash(fj+1.3)+t*0.02*(0.7+0.6*hash(fj+3.0)));
    float lx=ph*(asp+0.2)-0.1;
    float ly=0.88-ph*0.5+0.03*sin(t*0.6+fj*2.3)+0.15*hash(fj+7.0);
    vec2 d=p-vec2(lx,ly);
    float a=t*0.7+fj*1.7;
    d=vec2(cos(a)*d.x-sin(a)*d.y,sin(a)*d.x+cos(a)*d.y);
    float l=length(vec2(d.x,d.y*2.2));
    float fade=sin(ph*3.14159);
    vec3 lc=mix(vec3(0.72,0.36,0.18),vec3(0.85,0.62,0.25),hash(fj+11.0));
    col=mix(col,lc,smoothstep(0.017,0.011,l)*fade*0.85);
  }

  vec2 v=uv-0.5;
  col*=1.0-0.25*dot(v,v);
  gl_FragColor=vec4(col,1.0);
}