Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- varying vec2 UV;
- uniform sampler2D myTextureSampler;
- uniform sampler2D myTextureSampler2;
- uniform float transitionTime;
- float rand(float n) {
- return fract(sin(n) * 43758.5453123);
- }
- void main() {
- float tileMulti = 2.0;
- float randomness = 0.1;
- float tileIndex = 89.2*floor( UV.x * 16.0 * tileMulti)
- + 179.1*floor( UV.y * 9.0 * tileMulti);
- float tileDelta = rand(tileIndex)*randomness - randomness / 2.0;
- float x = -1.0 - randomness / 2.0 + UV.x + transitionTime * (1.0 + 1.0 + randomness);
- float tileColor = smoothstep(0.0, 1.0, clamp(x + tileDelta, 0.0, 1.0));
- gl_FragColor = texture2D( myTextureSampler, UV ) * (1.0 - tileColor)
- + texture2D( myTextureSampler2, UV ) * tileColor;
- //gl_FragColor = vec4(tileColor, tileColor, tileColor, 1.0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement