Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

Reorganised shader programs

File size: 1.2 KB
Line 
1// Note, this won't work on ATI which is why it's not used
2// the issue is with the array initializers
3// no card supports GL_3DL_array_objects but it does work on nvidia, not on ATI
4//#extension GL_3DL_array_objects : enable
5#version 120
6
7//-------------------------------
8//BlurV_ps20.glsl
9// Vertical Gaussian-Blur pass
10//-------------------------------
11
12uniform sampler2D Blur0;
13vec2 pos[11]  = vec2[11](
14        vec2(0.0, -5.0),
15        vec2(0.0, -4.0),
16        vec2(0.0, -3.0),
17        vec2(0.0, -2.0),
18        vec2(0.0, -1.0),
19        vec2(0.0, 0.0),
20        vec2(0.0, 1.0),
21        vec2(0.0, 2.0),
22        vec2(0.0, 3.0),
23        vec2(0.0, 4.0),
24        vec2(0.0, 5.0)
25);
26
27//We use the Normal-gauss distribution formula
28//f(x) being the formula, we used f(0.5)-f(-0.5); f(1.5)-f(0.5)...
29float samples[11] = float[11] 
30(//stddev=2.0
310.01222447,
320.02783468,
330.06559061,
340.12097757,
350.17466632,
36
370.19741265,
38
390.17466632,
400.12097757,
410.06559061,
420.02783468,
430.01222447
44);
45
46void main()
47{
48    vec4 retVal;
49   
50    vec4 sum;
51    vec2 texcoord = vec2(gl_TexCoord[0]);
52    int i = 0;
53
54    sum = vec4( 0 );
55    for( ;i < 11; i++ )
56    {
57        sum += texture2D( Blur0, texcoord + (pos[i] * 0.0100000) ) * samples[i];
58    }
59
60    gl_FragColor = sum;
61}
Note: See TracBrowser for help on using the repository browser.