Advertisement
Guest User

Untitled

a guest
Feb 11th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. varying vec2 UV;
  2.  
  3. uniform sampler2D myTextureSampler;
  4. uniform sampler2D myTextureSampler2;
  5. uniform float transitionTime;
  6.  
  7. float rand(float n) {
  8. return fract(sin(n) * 43758.5453123);
  9. }
  10.  
  11. void main() {
  12. float tileMulti = 2.0;
  13. float randomness = 0.1;
  14. float tileIndex = 89.2*floor( UV.x * 16.0 * tileMulti)
  15. + 179.1*floor( UV.y * 9.0 * tileMulti);
  16. float tileDelta = rand(tileIndex)*randomness - randomness / 2.0;
  17. float x = -1.0 - randomness / 2.0 + UV.x + transitionTime * (1.0 + 1.0 + randomness);
  18. float tileColor = smoothstep(0.0, 1.0, clamp(x + tileDelta, 0.0, 1.0));
  19. gl_FragColor = texture2D( myTextureSampler, UV ) * (1.0 - tileColor)
  20. + texture2D( myTextureSampler2, UV ) * tileColor;
  21. //gl_FragColor = vec4(tileColor, tileColor, tileColor, 1.0);
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement