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/OldTV.glsl

    r12083 r12091  
    2020void main()
    2121{
    22    // Define a frame shape
    23    float f = (1 - pos.x * pos.x) * (1 - pos.y * pos.y);
    24    float frame = clamp(frameSharpness * (pow(f, frameShape) - frameLimit), 0.0, 1.0);
     22    // Define a frame shape
     23    float f = (1 - pos.x * pos.x) * (1 - pos.y * pos.y);
     24    float frame = clamp(frameSharpness * (pow(f, frameShape) - frameLimit), 0.0, 1.0);
    2525
    26    // Interference ... just a texture filled with rand()
    27    float rand = texture(Rand, vec3(1.5 * pos.x, 1.5 * pos.y, time_0_X)).x - 0.2;
     26    // Interference ... just a texture filled with rand()
     27    float rand = texture(Rand, vec3(1.5 * pos.x, 1.5 * pos.y, time_0_X)).x - 0.2;
    2828
    29    // Some signed noise for the distortion effect
    30    float noisy = texture(Noise, vec3(0, 0.5 * pos.y, 0.1 * time_0_X)).x - 0.5;
     29    // Some signed noise for the distortion effect
     30    float noisy = texture(Noise, vec3(0, 0.5 * pos.y, 0.1 * time_0_X)).x - 0.5;
    3131
    32    // Repeat a 1 - x^2 (0 < x < 1) curve and roll it with sinus.
    33    float dst = fract(pos.y * distortionFreq + distortionRoll * sin_time_0_X);
    34    dst *= (1 - dst);
    35    // Make sure distortion is highest in the center of the image
    36    dst /= 1 + distortionScale * abs(pos.y);
     32    // Repeat a 1 - x^2 (0 < x < 1) curve and roll it with sinus.
     33    float dst = fract(pos.y * distortionFreq + distortionRoll * sin_time_0_X);
     34    dst *= (1 - dst);
     35    // Make sure distortion is highest in the center of the image
     36    dst /= 1 + distortionScale * abs(pos.y);
    3737
    38    // ... and finally distort
    39    vec2 inUv = oUv0;
    40    inUv.x += distortionScale * noisy * dst;
    41    vec4 image = texture(Image, inUv);
     38    // ... and finally distort
     39    vec2 inUv = oUv0;
     40    inUv.x += distortionScale * noisy * dst;
     41    vec4 image = texture(Image, inUv);
    4242
    43    // Combine frame, distorted image and interference
    44    fragColour = frame * (interference * rand + image);
     43    // Combine frame, distorted image and interference
     44    fragColour = frame * (interference * rand + image);
    4545}
    46 
Note: See TracChangeset for help on using the changeset viewer.