runnable fragment

Iridescent Oil Slick

stronghold-curated material glsl runnable fragment MIT
code snippet
precision mediump float;
uniform vec2 resolution;
uniform float time;
float hash(vec2 p){return fract(sin(dot(p,vec2(12.989,78.233)))*43758.5453);} 
float noise(vec2 p){vec2 i=floor(p),f=fract(p);f=f*f*(3.0-2.0*f);return mix(mix(hash(i),hash(i+vec2(1,0)),f.x),mix(hash(i+vec2(0,1)),hash(i+1.0),f.x),f.y);} 
void main(){
 vec2 uv=gl_FragCoord.xy/resolution.xy; uv.x*=resolution.x/resolution.y;
 float n=noise(uv*5.0+time*0.05)+0.5*noise(uv*13.0-time*0.04);
 float phase=n*8.0+uv.x*4.0-uv.y*3.0+time*0.15;
 vec3 rainbow=0.5+0.5*cos(phase+vec3(0.0,2.09,4.18));
 float sheen=smoothstep(0.2,1.0,n);
 gl_FragColor=vec4(mix(vec3(0.015,0.012,0.018), rainbow, sheen),1.0);
}
runnable fragment

Plasma Bloom Field

stronghold-curated plasma glsl runnable fragment MIT
code snippet
precision mediump float;
uniform vec2 resolution;
uniform float time;
void main() {
  vec2 uv = (gl_FragCoord.xy * 2.0 - resolution.xy) / min(resolution.x, resolution.y);
  float v = 0.0;
  v += sin(uv.x * 4.0 + time * 1.2);
  v += sin((uv.y * 5.0 + time * 0.9));
  v += sin((uv.x + uv.y) * 3.0 + time * 1.7);
  v += sin(length(uv + vec2(sin(time * 0.4), cos(time * 0.3))) * 8.0 - time * 2.0);
  v = v * 0.25 + 0.5;
  vec3 color = 0.5 + 0.5 * cos(6.28318 * (vec3(0.00, 0.22, 0.45) + v + time * 0.035));
  gl_FragColor = vec4(color, 1.0);
}
runnable fragment

Stained Glass Mosaic

stronghold-curated pattern glsl runnable fragment MIT
code snippet
precision mediump float;
uniform vec2 resolution;
uniform float time;
vec2 hash(vec2 p){p=vec2(dot(p,vec2(127.1,311.7)),dot(p,vec2(269.5,183.3)));return fract(sin(p)*43758.5453);} 
void main(){
 vec2 uv=gl_FragCoord.xy/resolution.xy; uv.x*=resolution.x/resolution.y;
 vec2 g=uv*8.0,id=floor(g),f=fract(g); float d=9.0; vec2 cell=vec2(0.0);
 for(int y=-1;y<=1;y++)for(int x=-1;x<=1;x++){vec2 o=vec2(float(x),float(y));vec2 r=hash(id+o);float nd=length(o+r-f);if(nd<d){d=nd;cell=id+o;}}
 float lead=smoothstep(0.06,0.025,d);
 vec3 glass=0.5+0.5*cos(vec3(0.0,2.2,4.4)+hash(cell).x*6.283+time*0.05);
 gl_FragColor=vec4(mix(glass*0.85,vec3(0.02),lead),1.0);
}