1/** 2 * @author zz85 / http://www.lab4games.net/zz85/blog 3 * 4 * Two pass Gaussian blur filter (horizontal and vertical blur shaders) 5 * - described in http://www.gamerendering.com/2008/10/11/gaussian-blur-filter-shader/ 6 * and used in http://www.cake23.de/traveling-wavefronts-lit-up.html 7 * 8 * - 9 samples per pass 9 * - standard deviation 2.7 10 * - "h" and "v" parameters should be set to "1 / width" and "1 / height" 11 */ 12 13THREE.HorizontalBlurShader = { 14 15 uniforms: { 16 17 "tDiffuse": { value: null }, 18 "h": { value: 1.0 / 512.0 } 19 20 }, 21 22 vertexShader: [ 23 24 "varying vec2 vUv;", 25 26 "void main() {", 27 28 "vUv = uv;", 29 "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", 30 31 "}" 32 33 ].join( "\n" ), 34 35 fragmentShader: [ 36 37 "uniform sampler2D tDiffuse;", 38 "uniform float h;", 39 40 "varying vec2 vUv;", 41 42 "void main() {", 43 44 "vec4 sum = vec4( 0.0 );", 45 46 "sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;", 47 "sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;", 48 "sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;", 49 "sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;", 50 "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;", 51 "sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;", 52 "sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;", 53 "sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;", 54 "sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;", 55 56 "gl_FragColor = sum;", 57 58 "}" 59 60 ].join( "\n" ) 61 62};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.