159b2e6871c65f58fdad78cd7229c292f6a177578Scott Bartauniform sampler2D m_Texture; // this should hold the texture rendered by the horizontal blur pass 259b2e6871c65f58fdad78cd7229c292f6a177578Scott Bartauniform float m_Size; 359b2e6871c65f58fdad78cd7229c292f6a177578Scott Bartauniform float m_Scale; 459b2e6871c65f58fdad78cd7229c292f6a177578Scott Bartavarying vec2 texCoord; 559b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta 659b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta 759b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta 859b2e6871c65f58fdad78cd7229c292f6a177578Scott Bartavoid main(void) 959b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta{ float blurSize = m_Scale/m_Size; 1059b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta vec4 sum = vec4(0.0); 1159b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta 1259b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta // blur in y (vertical) 1359b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta // take nine samples, with the distance blurSize between them 1459b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta sum += texture2D(m_Texture, vec2(texCoord.x, texCoord.y - 4.0*blurSize)) * 0.05; 1559b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta sum += texture2D(m_Texture, vec2(texCoord.x, texCoord.y - 3.0*blurSize)) * 0.09; 1659b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta sum += texture2D(m_Texture, vec2(texCoord.x, texCoord.y - 2.0*blurSize)) * 0.12; 1759b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta sum += texture2D(m_Texture, vec2(texCoord.x, texCoord.y - blurSize)) * 0.15; 1859b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta sum += texture2D(m_Texture, vec2(texCoord.x, texCoord.y)) * 0.16; 1959b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta sum += texture2D(m_Texture, vec2(texCoord.x, texCoord.y + blurSize)) * 0.15; 2059b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta sum += texture2D(m_Texture, vec2(texCoord.x, texCoord.y + 2.0*blurSize)) * 0.12; 2159b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta sum += texture2D(m_Texture, vec2(texCoord.x, texCoord.y + 3.0*blurSize)) * 0.09; 2259b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta sum += texture2D(m_Texture, vec2(texCoord.x, texCoord.y + 4.0*blurSize)) * 0.05; 2359b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta 2459b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta gl_FragColor = sum; 2559b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta}