Last change
on this file since 12096 was
12091,
checked in by wiesep, 6 years ago
|
Updated programs and adjusted Material to work with GLSL>150
|
File size:
1.1 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 | |
---|
12 | uniform sampler2D Blur0; |
---|
13 | varying vec2 texCoord; |
---|
14 | |
---|
15 | vec2 pos[11] = vec2[11]( |
---|
16 | vec2(0.0, -5.0), |
---|
17 | vec2(0.0, -4.0), |
---|
18 | vec2(0.0, -3.0), |
---|
19 | vec2(0.0, -2.0), |
---|
20 | vec2(0.0, -1.0), |
---|
21 | vec2(0.0, 0.0), |
---|
22 | vec2(0.0, 1.0), |
---|
23 | vec2(0.0, 2.0), |
---|
24 | vec2(0.0, 3.0), |
---|
25 | vec2(0.0, 4.0), |
---|
26 | vec2(0.0, 5.0) |
---|
27 | ); |
---|
28 | |
---|
29 | //We use the Normal-gauss distribution formula |
---|
30 | //f(x) being the formula, we used f(0.5)-f(-0.5); f(1.5)-f(0.5)... |
---|
31 | float samples[11] = float[11] |
---|
32 | (//stddev=2.0 |
---|
33 | 0.01222447, |
---|
34 | 0.02783468, |
---|
35 | 0.06559061, |
---|
36 | 0.12097757, |
---|
37 | 0.17466632, |
---|
38 | |
---|
39 | 0.19741265, |
---|
40 | |
---|
41 | 0.17466632, |
---|
42 | 0.12097757, |
---|
43 | 0.06559061, |
---|
44 | 0.02783468, |
---|
45 | 0.01222447 |
---|
46 | ); |
---|
47 | |
---|
48 | void main() |
---|
49 | { |
---|
50 | vec4 retVal; |
---|
51 | vec4 sum; |
---|
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.