uniform sampler2D BackgroundImage; uniform sampler2D Scope; varying vec2 texCoord; varying vec2 scopeTexCoord; uniform vec2 textureScale; uniform vec2 textureHalfScale; uniform vec4 backgroundColor; void main(void) { vec2 start, newTexCoord; vec4 scopeArea, blurColor; scopeArea = texture2D( Scope, scopeTexCoord ); newTexCoord = texCoord - textureHalfScale; newTexCoord = normalize( newTexCoord ); start = texCoord; if ( scopeArea.r > 0.0 ) { vec4 colors[6]; float len = scopeArea.r; vec2 amount = newTexCoord * len * 0.05; vec2 pos; pos = start - amount * 1.5; colors[0] = texture2D( BackgroundImage, pos ); pos = start - amount * 1.4; colors[1] = texture2D( BackgroundImage, pos ); pos = start - amount * 1.3; colors[2] = texture2D( BackgroundImage, pos ); pos = start - amount * 1.2; colors[3] = texture2D( BackgroundImage, pos ); pos = start - amount * 1.1; colors[4] = texture2D( BackgroundImage, pos ); pos = start - amount * 1.0; colors[5] = texture2D( BackgroundImage, pos ); gl_FragColor = (colors[0] + colors[1]+ colors[2]+ colors[3]+ colors[4]+ colors[5]) / 6.0; } else { gl_FragColor = texture2D( BackgroundImage, start ); } }