Skip to content

Instantly share code, notes, and snippets.

@fand fand/shit.frag
Created Dec 18, 2018

Embed
What would you like to do?
SHIT key effect on VEDA
/*{
IMPORTED: {
img: { PATH: 'shit.jpg' },
},
}*/
precision highp float;
uniform float time;
uniform vec2 resolution;
uniform sampler2D img;
void main() {
vec2 fragCoord = gl_FragCoord.xy;
fragCoord += vec2(sin(time * 71.), cos(time * 57.)) * 1.4;
fragCoord = (fragCoord - resolution * .5) * (1. + sin(time * 37.3) * sin(time * 23.3) * .02) + resolution * .5;
vec2 uv = fragCoord.xy / resolution;
vec2 p = (fragCoord.xy *2.- resolution) / min(resolution.x, resolution.y);
// offset
p += vec2(.1, .2);
float l = length(p);
l = l * l * 4.;
float a = atan(p.y, p.x);
float wave = sin(a * 37.+ time * 39.) * sin(a * 171. + time * 97.) *l;
l += wave * .1;
vec4 c = texture2D(img, uv);
// blur
for (int i = 0; i < 30; i++) {
float fi = float(i);
vec2 uv2 = (uv - .5) * (1. - l * fi *.001) + .5;
c += texture2D(img, uv2);
}
c /= 30.;
c *= 1. + wave * .03;
// color grading
c = smoothstep(.05, .9, c);
c.r = pow(c.r, .8 + l * .1);
c *= 1. - l * l * .008;
gl_FragColor = c;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.