I am trying to write blur shader for iPad. I have a job, but I'm not very happy with the results. I get very choppy frame rates, and the blur looks like shit when the amount of blur is large.
Any ideas on how to improve the situation?
Some output:

uniform sampler2D texture; varying mediump vec2 fragTexCoord; varying mediump vec3 eyespaceNormal; varying highp float blurAmount; void main(void) { highp vec2 gaussFilter[7]; gaussFilter[0] = vec2(-3.0, 0.015625); gaussFilter[1] = vec2(-2.0, 0.09375); gaussFilter[2] = vec2(-1.0, 0.234375); gaussFilter[3] = vec2(0.0, 0.3125); gaussFilter[4] = vec2(1.0, 0.234375); gaussFilter[5] = vec2(2.0, 0.09375); gaussFilter[6] = vec2(3.0, 0.015625); highp float blurSize = blurAmount * 1.0; ///////////////////////////////////////////////// // 7x1 gaussian blur fragment shader ///////////////////////////////////////////////// highp vec4 color = vec4(0,0,0,1); for( int i = 0; i < 7; i++ ) { color += texture2D( texture, vec2( fragTexCoord.x+gaussFilter[i].x*blurSize, fragTexCoord.y+gaussFilter[i].x*blurSize ) )*gaussFilter[i].y; } gl_FragColor = color; }
Edit: Blurring in a box can be a way. Here is the shader blur version:
highp vec4 color = vec4(0,0,0,1); color += texture2D(texture, vec2(fragTexCoord.x, fragTexCoord.y - 4.0*blurAmount)) * 0.05; color += texture2D(texture, vec2(fragTexCoord.x, fragTexCoord.y - 3.0*blurAmount)) * 0.09; color += texture2D(texture, vec2(fragTexCoord.x, fragTexCoord.y - 2.0*blurAmount)) * 0.12; color += texture2D(texture, vec2(fragTexCoord.x, fragTexCoord.y - blurAmount)) * 0.15; color += texture2D(texture, vec2(fragTexCoord.x, fragTexCoord.y)) * 0.16; color += texture2D(texture, vec2(fragTexCoord.x, fragTexCoord.y + blurAmount)) * 0.15; color += texture2D(texture, vec2(fragTexCoord.x, fragTexCoord.y + 2.0*blurAmount)) * 0.12; color += texture2D(texture, vec2(fragTexCoord.x, fragTexCoord.y + 3.0*blurAmount)) * 0.09; color += texture2D(texture, vec2(fragTexCoord.x, fragTexCoord.y + 4.0*blurAmount)) * 0.05; gl_FragColor = color;
Here is the result of blurring the drawer (note that this is only horizontal blur, but this may be enough for what I want): 