Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/branches/Shader_HS18/programs/Example/GLSL/BlurH_ps20.glsl @ 12083

Last change on this file since 12083 was 12083, checked in by wiesep, 6 years ago

Reorganised shader programs

File size: 976 bytes
Line 
1//-------------------------------
2//BlurH_ps20.glsl
3// Horizontal Gaussian-Blur pass
4//-------------------------------
5#version 120
6
7uniform sampler2D Blur0;
8vec2 pos[11] = vec2[11]
9(
10        vec2( -5, 0),
11        vec2( -4, 0),
12        vec2( -3, 0),
13        vec2( -2, 0),
14        vec2( -1, 0),
15        vec2( 0, 0),
16        vec2( 1, 0),
17        vec2( 2, 0),
18        vec2( 3, 0),
19        vec2( 4, 0),
20        vec2( 5, 0)
21);
22
23//We use the Normal-gauss distribution formula
24//f(x) being the formula, we used f(0.5)-f(-0.5); f(1.5)-f(0.5)...
25float samples[11] = float[11]
26(//stddev=2.0
270.01222447,
280.02783468,
290.06559061,
300.12097757,
310.17466632,
32
330.19741265,
34
350.17466632,
360.12097757,
370.06559061,
380.02783468,
390.01222447
40);
41
42void main()
43{
44    vec4 retVal;
45   
46    vec4 sum;
47    vec2 texcoord = vec2( gl_TexCoord[0] );
48    int i = 0;
49
50    sum = vec4( 0 );
51    for( i=0;i < 11; i++ )
52    {
53        sum += texture2D( Blur0, texcoord + (pos[i] * 0.0100000) ) * samples[i];
54    }
55
56    gl_FragColor = sum;
57}
Note: See TracBrowser for help on using the repository browser.