2015-09-02 03:44:16 +03:00
|
|
|
#version 100
|
|
|
|
|
|
|
|
precision mediump float;
|
|
|
|
|
2016-05-18 13:04:27 +03:00
|
|
|
// Input vertex attributes (from vertex shader)
|
2015-09-02 03:44:16 +03:00
|
|
|
varying vec2 fragTexCoord;
|
2016-05-18 13:04:27 +03:00
|
|
|
varying vec4 fragColor;
|
2015-09-02 03:44:16 +03:00
|
|
|
|
2016-05-18 13:04:27 +03:00
|
|
|
// Input uniform values
|
2015-09-02 03:44:16 +03:00
|
|
|
uniform sampler2D texture0;
|
2016-01-13 19:13:28 +03:00
|
|
|
uniform vec4 fragTintColor;
|
2015-09-02 03:44:16 +03:00
|
|
|
|
|
|
|
// NOTE: Add here your custom variables
|
|
|
|
|
|
|
|
float offset = 0;
|
|
|
|
float frequency = 720/3.0;
|
|
|
|
|
|
|
|
uniform float time;
|
|
|
|
|
2016-05-18 13:04:27 +03:00
|
|
|
void main()
|
2015-09-02 03:44:16 +03:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
// Scanlines method 1
|
|
|
|
float tval = 0; //time
|
|
|
|
vec2 uv = 0.5 + (fragTexCoord - 0.5)*(0.9 + 0.01*sin(0.5*tval));
|
|
|
|
|
|
|
|
vec4 color = texture2D(texture0, fragTexCoord);
|
|
|
|
|
|
|
|
color = clamp(color*0.5 + 0.5*color*color*1.2, 0.0, 1.0);
|
|
|
|
color *= 0.5 + 0.5*16.0*uv.x*uv.y*(1.0 - uv.x)*(1.0 - uv.y);
|
|
|
|
color *= vec4(0.8, 1.0, 0.7, 1);
|
|
|
|
color *= 0.9 + 0.1*sin(10.0*tval + uv.y*1000.0);
|
|
|
|
color *= 0.97 + 0.03*sin(110.0*tval);
|
|
|
|
|
|
|
|
fragColor = color;
|
|
|
|
*/
|
|
|
|
// Scanlines method 2
|
|
|
|
float globalPos = (fragTexCoord.y + offset) * frequency;
|
|
|
|
float wavePos = cos((fract(globalPos) - 0.5)*3.14);
|
|
|
|
|
|
|
|
vec4 color = texture2D(texture0, fragTexCoord);
|
|
|
|
|
|
|
|
gl_FragColor = mix(vec4(0, 0.3, 0, 0), color, wavePos);
|
|
|
|
}
|