uniform float AppFrame; // frame number since app starts void frag (void) { float size = 15.0; float amount = Amount / 127.0 * 0.4; vec2 uv = TexCoord * size; if (isRand) uv = fract(uv + 0.031 * AppFrame); uv = texture2D_NoiseSamp(fract(uv)).xy - 0.5; if (dir == 0) { // both directions uv *= (vec2(1.5, 0.15) * amount); } else if (dir == 1) { // x direction uv *= (vec2(1.3, 0.0) * amount); } else { // y direction uv *= (vec2(0.0, 0.29) * amount); } uv += TexCoord; // shift half of a pixel size of the source to avoid the artifact on upper right borders. // FBO size is bigger than the sprite, so clamping to [0, 1] will introduce artifacts // (when OpenGL glTexParameter is set to linear). Lets not rely on OpenGL to clamp. we // do it here. vec2 halfPixelSize = 0.5 / Texture0Info.xy; colorOutput(texture2D_0(clamp(uv, halfPixelSize, 1.0-halfPixelSize))); }