|
Last change
on this file since 12091 was
12091,
checked in by wiesep, 7 years ago
|
|
Updated programs and adjusted Material to work with GLSL>150
|
|
File size:
1.3 KB
|
| Line | |
|---|
| 1 | #version 100 |
|---|
| 2 | precision mediump int; |
|---|
| 3 | precision mediump float; |
|---|
| 4 | |
|---|
| 5 | //------------------------------- |
|---|
| 6 | //BlurH_ps20.glsles |
|---|
| 7 | // Horizontal Gaussian-Blur pass |
|---|
| 8 | //------------------------------- |
|---|
| 9 | |
|---|
| 10 | uniform sampler2D Blur0; |
|---|
| 11 | varying vec2 texCoord; |
|---|
| 12 | |
|---|
| 13 | vec2 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)... |
|---|
| 16 | float samples[11]; |
|---|
| 17 | |
|---|
| 18 | void 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.