runnable fragment

Grain

glitch-core material glsl runnable fragment MIT
code snippet
precision mediump float;
varying vec2 v_texCoord;
uniform sampler2D u_texture;
uniform vec2 u_resolution;
uniform float u_intensity; // 0-1
uniform float u_size;      // grain size (0.5-10)
uniform int   u_color;     // 0=color, 1=grayscale

float hash(vec2 p) {
  return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453);
}

void main() {
  vec4 c = texture2D(u_texture, v_texCoord);
runnable fragment

Wood Grain Material

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(13.13, 117.17))) * 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*9.0) + 0.5*noise(uv*22.0);
 float rings = sin((uv.x + n*0.09 + 0.02*sin(uv.y*18.0)) * 55.0);
 float grain = smoothstep(-0.2, 1.0, rings);
 vec3 dark = vec3(0.22,0.10,0.035), light = vec3(0.72,0.38,0.13);
 gl_FragColor = vec4(mix(dark, light, grain) * (0.75 + 0.25*n), 1.0);
}