Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/branches/Shader_HS18/programs/GLSL150/HeatBlurFp.glsl @ 12115

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

Changed folder structure, deletet some unused files and cleaned up code

File size: 1.5 KB
Line 
1#version 150
2
3uniform sampler2D Input;
4uniform vec4 blurAmount;
5
6in vec2 uv;
7out vec4 fragColour;
8
9void main()
10{
11    int i;
12    vec4 tmpOutColor;
13    float  diffuseGlowFactor;
14    vec2 offsets[4];
15    /*
16    // hazy blur
17    -1.8, -1.8,
18    -1.8, 1.8,
19    1.8, -1.8,
20    1.8, 1.8
21    */
22    /*
23    // less-hazy blur
24    -1.0,  2.0,
25    -1.0, -1.0,
26    1.0, -1.0,
27    1.0,  1.0
28    */
29    /*
30      -0.326212, -0.405805,
31      -0.840144, -0.073580,
32      -0.695914,  0.457137,
33      -0.203345,  0.620716
34    */
35
36    offsets[0] = vec2(-0.3,  0.4);
37    offsets[1] = vec2(-0.3,  -0.4);
38    offsets[2] = vec2(0.3,  -0.4);
39    offsets[3] = vec2(0.3,  0.4);
40
41    tmpOutColor = texture( Input, uv ); // UV coords are in image space
42
43    // calculate glow amount
44    diffuseGlowFactor = 0.0113 * (2.0 - max( tmpOutColor.r, tmpOutColor.g ));
45
46    // basic blur filter
47    for (i = 0; i < 4; i++) {
48        tmpOutColor += texture( Input, uv + blurAmount.x * diffuseGlowFactor * offsets[i] );
49    }
50
51    tmpOutColor *= 0.25;
52
53    // TIPS (old-skool strikes again!)
54    // Pay attention here! If you use the "out float4 outColor" directly
55    // in your steps while creating the output color (like you remove
56    // the "tmpOutColor" var and just use the "outColor" directly)
57    // your pixel-color output IS CHANGING EACH TIME YOU DO AN ASSIGNMENT TOO!
58    // A temporary variable, instead, acts like a per-pixel double buffer, and
59    // best of all, lead to better performance.
60    fragColour = tmpOutColor;
61}
Note: See TracBrowser for help on using the repository browser.