Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/branches/Shader_HS18/programs/Example/GLSLES/OldTV.glsles @ 12091

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.4 KB
Line 
1#version 300 es
2
3precision mediump int;
4precision mediump float;
5
6in vec4 pos;
7in vec2 oUv0;
8out vec4 fragColour;
9
10uniform sampler2D Image;
11uniform lowp sampler3D Rand;
12uniform lowp sampler3D Noise;
13uniform float distortionFreq;
14uniform float distortionScale;
15uniform float distortionRoll;
16uniform float interference;
17uniform float frameLimit;
18uniform float frameShape;
19uniform float frameSharpness;
20uniform float time_0_X;
21uniform float sin_time_0_X;
22
23void main()
24{
25   // Define a frame shape
26   float f = (1.0 - pos.x * pos.x) * (1.0 - pos.y * pos.y);
27   float frame = clamp(frameSharpness * (pow(f, frameShape) - frameLimit), 0.0, 1.0);
28
29   // Interference ... just a texture filled with rand()
30   float rand = texture(Rand, vec3(1.5 * pos.x, 1.5 * pos.y, time_0_X)).x - 0.2;
31
32   // Some signed noise for the distortion effect
33   float noisy = texture(Noise, vec3(0, 0.5 * pos.y, 0.1 * time_0_X)).x - 0.5;
34
35   // Repeat a 1 - x^2 (0 < x < 1) curve and roll it with sinus.
36   float dst = fract(pos.y * distortionFreq + distortionRoll * sin_time_0_X);
37   dst *= (1.0 - dst);
38   // Make sure distortion is highest in the center of the image
39   dst /= 1.0 + distortionScale * abs(pos.y);
40
41   // ... and finally distort
42   vec2 inUv = oUv0;
43   inUv.x += distortionScale * noisy * dst;
44   vec4 image = texture(Image, inUv);
45
46   // Combine frame, distorted image and interference
47   fragColour = frame * (interference * rand + image);
48}
49
Note: See TracBrowser for help on using the repository browser.