I am going to answer my own question.
In the end, I changed only the fragment shader:
varying vec4 vColor; varying vec2 vTexCoord; uniform vec2 screenSize; uniform sampler2D u_texture; uniform vec4 v_time; const float RADIUS = 0.75; const float SOFTNESS = 0.6; const float blurSize = 1.0/1000.0; void main() { vec4 texColor = vec4(0.0);
The actual blur effect is recorded here:
vec4 texColor = vec4(0.0); // texture2D(u_texture, vTexCoord) texColor += texture2D(u_texture, vTexCoord - 4.0*blurSize) * 0.05; texColor += texture2D(u_texture, vTexCoord - 3.0*blurSize) * 0.09; texColor += texture2D(u_texture, vTexCoord - 2.0*blurSize) * 0.12; texColor += texture2D(u_texture, vTexCoord - blurSize) * 0.15; texColor += texture2D(u_texture, vTexCoord) * 0.16; texColor += texture2D(u_texture, vTexCoord + blurSize) * 0.15; texColor += texture2D(u_texture, vTexCoord + 2.0*blurSize) * 0.12; texColor += texture2D(u_texture, vTexCoord + 3.0*blurSize) * 0.09; texColor += texture2D(u_texture, vTexCoord + 4.0*blurSize) * 0.05;
The effect creates a Gaussian blur, only with GLSL. You can always customize the variables to your liking.
Israelg99
source share