• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1uniform sampler2D m_Texture; // this should hold the texture rendered by the horizontal blur pass
2uniform float m_Size;
3uniform float m_Scale;
4
5varying vec2 texCoord;
6
7void main(){
8   float blurSize = m_Scale/m_Size;
9   vec4 sum = vec4(0.0);
10
11   // blur in x (vertical)
12   // take nine samples, with the distance blurSize between them
13   sum += texture2D(m_Texture, vec2(texCoord.x- 4.0*blurSize, texCoord.y )) * 0.05;
14   sum += texture2D(m_Texture, vec2(texCoord.x- 3.0*blurSize, texCoord.y )) * 0.09;
15   sum += texture2D(m_Texture, vec2(texCoord.x - 2.0*blurSize, texCoord.y)) * 0.12;
16   sum += texture2D(m_Texture, vec2(texCoord.x- blurSize, texCoord.y )) * 0.15;
17   sum += texture2D(m_Texture, vec2(texCoord.x, texCoord.y)) * 0.16;
18   sum += texture2D(m_Texture, vec2(texCoord.x+ blurSize, texCoord.y )) * 0.15;
19   sum += texture2D(m_Texture, vec2(texCoord.x+ 2.0*blurSize, texCoord.y )) * 0.12;
20   sum += texture2D(m_Texture, vec2(texCoord.x+ 3.0*blurSize, texCoord.y )) * 0.09;
21   sum += texture2D(m_Texture, vec2(texCoord.x+ 4.0*blurSize, texCoord.y )) * 0.05;
22
23   gl_FragColor = sum;
24}