Last change
on this file since 12323 was
12115,
checked in by wiesep, 6 years ago
|
Changed folder structure, deletet some unused files and cleaned up code
|
File size:
894 bytes
|
Line | |
---|
1 | //------------------------------- |
---|
2 | //BlurH_ps20.glsl |
---|
3 | // Horizontal Gaussian-Blur pass |
---|
4 | //------------------------------- |
---|
5 | #version 120 |
---|
6 | |
---|
7 | uniform sampler2D Blur0; |
---|
8 | varying vec2 texCoord; |
---|
9 | |
---|
10 | vec2 pos[11] = vec2[11] |
---|
11 | ( |
---|
12 | vec2( -5, 0), |
---|
13 | vec2( -4, 0), |
---|
14 | vec2( -3, 0), |
---|
15 | vec2( -2, 0), |
---|
16 | vec2( -1, 0), |
---|
17 | vec2( 0, 0), |
---|
18 | vec2( 1, 0), |
---|
19 | vec2( 2, 0), |
---|
20 | vec2( 3, 0), |
---|
21 | vec2( 4, 0), |
---|
22 | vec2( 5, 0) |
---|
23 | ); |
---|
24 | |
---|
25 | //We use the Normal-gauss distribution formula |
---|
26 | //f(x) being the formula, we used f(0.5)-f(-0.5); f(1.5)-f(0.5)... |
---|
27 | float samples[11] = float[11] |
---|
28 | (//stddev=2.0 |
---|
29 | 0.01222447, |
---|
30 | 0.02783468, |
---|
31 | 0.06559061, |
---|
32 | 0.12097757, |
---|
33 | 0.17466632, |
---|
34 | |
---|
35 | 0.19741265, |
---|
36 | |
---|
37 | 0.17466632, |
---|
38 | 0.12097757, |
---|
39 | 0.06559061, |
---|
40 | 0.02783468, |
---|
41 | 0.01222447 |
---|
42 | ); |
---|
43 | |
---|
44 | void main() |
---|
45 | { |
---|
46 | vec4 retVal; |
---|
47 | vec4 sum; |
---|
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.