Back to Drone Zone — deep field
SOURCE / PINNED RELEASE

Made of little things.

Drone Zone — deep field

Release
578f277a8be1
Author-recorded commit
a96742b428de…
License
LICENSE
Author’s source reference
nostr://npub1n8ga89w8h6tvwamxusfyzexw8gjy84yxu9rxgnmk955cxtml4ujswzxydd/wss%3A%2F%2Fgit.napplet.soy%2F/n-9753e6cf3ec

Archive hash verified: f7f3bf8ff3482551. The source-to-build association is the author’s claim; it has not been independently rebuilt.

src/galaxy.frag
precision highp float;
uniform sampler2D u_image;
uniform sampler2D u_slices;
uniform vec2 u_resolution;
uniform vec2 u_pan;
uniform vec2 u_pointer;
uniform float u_scale;
uniform float u_time;
uniform float u_fog;
uniform float u_distortion;
varying vec2 v_uv;
float hash(vec2 p) { return fract(sin(dot(p,vec2(127.1,311.7)))*43758.5453); }
float noise(vec2 p) { vec2 i=floor(p),f=fract(p); f=f*f*(3.-2.*f); return mix(mix(hash(i),hash(i+vec2(1,0)),f.x),mix(hash(i+vec2(0,1)),hash(i+1.),f.x),f.y); }
float fbm(vec2 p) { return noise(p)*.55+noise(p*2.03)*.27+noise(p*4.01)*.13; }
vec3 photograph(vec2 uv,float chroma) {
  vec2 photo=clamp((uv-.5)*.88+.5,vec2(.005),vec2(.995));
  photo.y=1.-photo.y;
  vec3 color=texture2D(u_image,photo).rgb;
  color.r=texture2D(u_image,photo+vec2(chroma,0.)).r;
  color.b=texture2D(u_image,photo-vec2(chroma,0.)).b;
  return color;
}
void main() {
  vec2 screen=vec2(v_uv.x,1.-v_uv.y);
  vec2 world=(screen-.5)*u_resolution/u_scale+u_pan;
  vec2 uv=world/vec2(2250.,1420.)+.5;
  // A monotonic coordinate warp varies spacing along the broad curve. Jittered
  // neighboring boundaries add irregular widths without scanning every slice.
  float coordinate=(uv.x-.02)*42.+.64*sin(uv.x*9.)+.32*sin(uv.x*23.);
  float column=floor(coordinate);
  float edgeX=column+.28*(hash(vec2(column,4.7))-.5);
  if(coordinate<edgeX)column-=1.;
  else if(coordinate>=column+1.+.28*(hash(vec2(column+1.,4.7))-.5))column+=1.;
  edgeX=column+.28*(hash(vec2(column,4.7))-.5);
  float nextEdge=column+1.+.28*(hash(vec2(column+1.,4.7))-.5);
  float cell=(coordinate-edgeX)/(nextEdge-edgeX);
  float center=.02+(column+.5)/42.;
  float curve=.50+.14*sin(center*7.2-.9);
  vec4 properties=texture2D(u_slices,vec2((column+.5)/64.,.5));
  float above=properties.r,below=properties.g;
  // Two contiguous banks frame an untouched central opening. Each bank fades
  // outward and vertically; individual slices have no empty spacing or hard ends.
  float vertical=(uv.y-curve)/(uv.y<curve?above:below);
  float leftBank=smoothstep(.01,.35,uv.x)*(1.-smoothstep(.385,.405,uv.x));
  float rightBank=smoothstep(.595,.615,uv.x)*(1.-smoothstep(.69,1.04,uv.x));
  float band=leftBank+rightBank;
  float sliced=band*exp(-vertical*vertical*1.5);
  float depth=properties.b;
  float fold=(properties.a-.5)*.25;
  // Translate each slice as one rigid piece. Fade sampled colors, never texture
  // coordinates: a varying offset stretches stars into diagonal trails.
  vec2 offset=vec2(0.,fold*.12+sin(u_time*.11+column*.71)*.0015);
  offset+=u_pointer*depth*.002;
  float chroma=(.00035+.00035*sin(uv.y*14.+u_time*.12))*u_distortion;
  vec3 color=mix(photograph(uv,chroma),photograph(uv+offset,chroma),sliced);
  vec3 source=color;
  float edge=mix(1.,.56+.44*smoothstep(0.,.15,cell),sliced*.8);
  color=pow(color,vec3(1.28))*vec3(.64,.75,.87)*edge;
  // A dark envelope makes the folded light read as a suspended structure,
  // leaving room above and below it for the independent signal field.
  float ridge=.50+.14*sin(uv.x*7.2-.9)+fold*sliced*.4;
  float envelope=exp(-pow((uv.y-ridge)/.23,2.));
  color*=.16+.84*envelope;
  color*=.7+.3*smoothstep(.0,.55,uv.x);
  // Lift only luminous knots and star cores, preserving the muted field between them.
  float brilliance=smoothstep(.46,.92,max(source.r,max(source.g,source.b)));
  color+=pow(source,vec3(2.4))*brilliance*vec3(.54,.62,.82)*edge*(.25+.75*envelope);
  float coverage=smoothstep(-.12,.08,uv.x)*(1.-smoothstep(.92,1.12,uv.x))
    *smoothstep(-.12,.08,uv.y)*(1.-smoothstep(.92,1.12,uv.y));
  color*=coverage;
  float haze=fbm(world*.002+vec2(u_time*.009,-u_time*.005));
  float cloud=smoothstep(.37,.83,haze)*u_fog;
  color+=vec3(.024,.054,.081)*cloud;
  color+=vec3(.07,.024,.013)*cloud*smoothstep(.3,.8,uv.y);
  float boundary=(1.-smoothstep(0.,.008,cell))*sliced;
  color+=vec3(.08,.16,.21)*boundary*.32*coverage;
  float vignette=1.-.53*pow(length((screen-.5)*vec2(1.,.9)),1.3);
  color*=vignette;
  color+=vec3(hash(gl_FragCoord.xy+floor(u_time*6.))-.5)*.009;
  gl_FragColor=vec4(color,1.);
}