Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/branches/Shader_HS18/programs/Example/GLSLES/BlurH_ps20.glsles @ 12091

Last change on this file since 12091 was 12091, checked in by wiesep, 5 years ago

Updated programs and adjusted Material to work with GLSL>150

File size: 1.3 KB
Line 
1#version 100
2precision mediump int;
3precision mediump float;
4
5//-------------------------------
6//BlurH_ps20.glsles
7// Horizontal Gaussian-Blur pass
8//-------------------------------
9
10uniform sampler2D Blur0;
11varying vec2 texCoord;
12
13vec2 pos[11];
14//We use the Normal-gauss distribution formula
15//f(x) being the formula, we used f(0.5)-f(-0.5); f(1.5)-f(0.5)...
16float samples[11];
17
18void main()
19{
20        pos[0] = vec2(-5.0, 0.0);
21        pos[1] = vec2(-4.0, 0.0);
22        pos[2] = vec2(-3.0, 0.0);
23        pos[3] = vec2(-2.0, 0.0);
24        pos[4] = vec2(-1.0, 0.0);
25        pos[5] = vec2(0.0, 0.0);
26        pos[6] = vec2(1.0, 0.0);
27        pos[7] = vec2(2.0, 0.0);
28        pos[8] = vec2(3.0, 0.0);
29        pos[9] = vec2(4.0, 0.0);
30        pos[10] = vec2(5.0, 0.0);
31
32        //We use the Normal-gauss distribution formula
33        //f(x) being the formula, we used f(0.5)-f(-0.5); f(1.5)-f(0.5)...
34        //stddev=2.0
35        samples[0] = 0.01222447;
36        samples[1] = 0.02783468;
37        samples[2] = 0.06559061;
38        samples[3] = 0.12097757;
39        samples[4] = 0.17466632;
40        samples[5] = 0.19741265;
41        samples[6] = 0.17466632;
42        samples[7] = 0.12097757;
43        samples[8] = 0.06559061;
44        samples[9] = 0.02783468;
45        samples[10] = 0.01222447;
46       
47    vec4 retVal;
48    vec4 sum;
49    int i = 0;
50
51    sum = vec4( 0 );
52    for( i = 0;i < 11; i++ )
53    {
54        sum += texture2D( Blur0, texCoord + (pos[i] * 0.0100000) ) * samples[i];
55    }
56
57    gl_FragColor = sum;
58}
Note: See TracBrowser for help on using the repository browser.