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.5 KB
|
Line | |
---|
1 | #version 100 |
---|
2 | precision mediump int; |
---|
3 | precision mediump float; |
---|
4 | |
---|
5 | // Note, this won't work on ATI which is why it's not used |
---|
6 | // the issue is with the array initializers |
---|
7 | // no card supports GL_3DL_array_objects but it does work on nvidia, not on ATI |
---|
8 | //#extension GL_3DL_array_objects : enable |
---|
9 | |
---|
10 | //------------------------------- |
---|
11 | //BlurV_ps20.glsles |
---|
12 | // Vertical Gaussian-Blur pass |
---|
13 | //------------------------------- |
---|
14 | |
---|
15 | uniform sampler2D Blur0; |
---|
16 | varying vec2 texCoord; |
---|
17 | |
---|
18 | vec2 pos[11]; |
---|
19 | //We use the Normal-gauss distribution formula |
---|
20 | //f(x) being the formula, we used f(0.5)-f(-0.5); f(1.5)-f(0.5)... |
---|
21 | float samples[11]; |
---|
22 | |
---|
23 | void main() |
---|
24 | { |
---|
25 | pos[0] = vec2(0.0, -5.0); |
---|
26 | pos[1] = vec2(0.0, -4.0); |
---|
27 | pos[2] = vec2(0.0, -3.0); |
---|
28 | pos[3] = vec2(0.0, -2.0); |
---|
29 | pos[4] = vec2(0.0, -1.0); |
---|
30 | pos[5] = vec2(0.0, 0.0); |
---|
31 | pos[6] = vec2(0.0, 1.0); |
---|
32 | pos[7] = vec2(0.0, 2.0); |
---|
33 | pos[8] = vec2(0.0, 3.0); |
---|
34 | pos[9] = vec2(0.0, 4.0); |
---|
35 | pos[10] = vec2(0.0, 5.0); |
---|
36 | |
---|
37 | //We use the Normal-gauss distribution formula |
---|
38 | //f(x) being the formula, we used f(0.5)-f(-0.5); f(1.5)-f(0.5)... |
---|
39 | //stddev=2.0 |
---|
40 | samples[0] = 0.01222447; |
---|
41 | samples[1] = 0.02783468; |
---|
42 | samples[2] = 0.06559061; |
---|
43 | samples[3] = 0.12097757; |
---|
44 | samples[4] = 0.17466632; |
---|
45 | samples[5] = 0.19741265; |
---|
46 | samples[6] = 0.17466632; |
---|
47 | samples[7] = 0.12097757; |
---|
48 | samples[8] = 0.06559061; |
---|
49 | samples[9] = 0.02783468; |
---|
50 | samples[10] = 0.01222447; |
---|
51 | |
---|
52 | vec4 retVal; |
---|
53 | vec4 sum; |
---|
54 | int i = 0; |
---|
55 | |
---|
56 | sum = vec4( 0 ); |
---|
57 | for( ;i < 11; i++ ) |
---|
58 | { |
---|
59 | sum += texture2D( Blur0, texCoord + (pos[i] * 0.0100000) ) * samples[i]; |
---|
60 | } |
---|
61 | |
---|
62 | gl_FragColor = sum; |
---|
63 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.