Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 9, 2018, 1:06:05 PM (5 years ago)
Author:
wiesep
Message:

Updated programs and adjusted Material to work with GLSL>150

File:
1 edited

Legend:

Unmodified
Added
Removed
  • data/branches/Shader_HS18/programs/Example/GLSL150/HeatBlurFp.glsl

    r12083 r12091  
    99void main()
    1010{
    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 /*
     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    /*
    3030      -0.326212, -0.405805,
    3131      -0.840144, -0.073580,
    3232      -0.695914,  0.457137,
    3333      -0.203345,  0.620716
    34 */
     34    */
    3535
    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);
     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);
    4040
    41    tmpOutColor = texture( Input, uv );  // UV coords are in image space
     41    tmpOutColor = texture( Input, uv ); // UV coords are in image space
    4242
    43    // calculate glow amount
    44    diffuseGlowFactor = 0.0113 * (2.0 - max( tmpOutColor.r, tmpOutColor.g ));
     43    // calculate glow amount
     44    diffuseGlowFactor = 0.0113 * (2.0 - max( tmpOutColor.r, tmpOutColor.g ));
    4545
    46    // basic blur filter
    47    for (i = 0; i < 4; i++) {
    48       tmpOutColor += texture( Input, uv + blurAmount.x * diffuseGlowFactor * offsets[i] );
    49    }
     46    // basic blur filter
     47    for (i = 0; i < 4; i++) {
     48        tmpOutColor += texture( Input, uv + blurAmount.x * diffuseGlowFactor * offsets[i] );
     49    }
    5050
    51    tmpOutColor *= 0.25;
     51    tmpOutColor *= 0.25;
    5252
    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;
     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;
    6161}
Note: See TracChangeset for help on using the changeset viewer.