- Timestamp:
- Nov 9, 2018, 1:06:05 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
data/branches/Shader_HS18/programs/Example/GLSL150/OldTV.glsl
r12083 r12091 20 20 void main() 21 21 { 22 // Define a frame shape23 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); 25 25 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; 28 28 29 // Some signed noise for the distortion effect30 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; 31 31 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 image36 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); 37 37 38 // ... and finally distort39 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); 42 42 43 // Combine frame, distorted image and interference44 fragColour = frame * (interference * rand + image);43 // Combine frame, distorted image and interference 44 fragColour = frame * (interference * rand + image); 45 45 } 46
Note: See TracChangeset
for help on using the changeset viewer.