Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kevindjacobson/33ab819342e602aabeae16f8d7e11cf9 to your computer and use it in GitHub Desktop.
Save kevindjacobson/33ab819342e602aabeae16f8d7e11cf9 to your computer and use it in GitHub Desktop.
float rand(vec3 co)
{
return fract(sin( dot(co.xyz ,vec3(12.9898,78.233,45.5432) )) * 43758.5453);
}
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
vec2 squares = vec2(80.0,60.0);
vec2 uv = fragCoord.xy / iResolution.xy;
float r = mod(iGlobalTime, 3.0) / 3.0;
vec2 squareP = floor(uv * squares);
float b = abs(rand(vec3(squareP,1.0)));
float dim;
if (b < r) {
dim = 1.0;
} else {
dim = 0.0;
}
fragColor = texture2D(iChannel0,uv)*dim + texture2D(iChannel1,uv)*(1.0-dim);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment