Skip to content

Instantly share code, notes, and snippets.

@fand fand/video.frag
Created Nov 9, 2017

Embed
What would you like to do?
precision mediump float;
uniform float time;
uniform vec2 resolution;
uniform sampler2D video1;
uniform sampler2D video2;
uniform sampler2D video3;
vec2 rotate(in vec2 p, in float t) {
return mat2(
sin(t), cos(t),
cos(t), -sin(t)
) * p;
}
void main() {
float t = time * .3;
vec2 uv = gl_FragCoord.xy / resolution;
uv -= .5;
uv.y *= resolution.y / resolution.x;
// uv *= uv;
vec2 uv1 = mod(uv * mat2(
1, sin(time * .2) * 9.,
cos(time * .4 + .2) * -.5, 1
), .12);
vec2 uv2 = mod(uv * mat2(
1, sin(time * .3) * .8,
cos(time *.3) * 2., 1
), .17);
uv2 = rotate(uv2, t) + .5;
gl_FragColor = (
texture2D(video1, uv1) +
texture2D(video2, uv2)
) * .5;
}
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.