2014-05-05 13:27:47 +08:00
|
|
|
// Shader taken from: http://webglsamples.googlecode.com/hg/electricflower/electricflower.html
|
|
|
|
|
|
|
|
#ifdef GL_ES
|
|
|
|
precision mediump float;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
varying vec4 v_fragmentColor;
|
|
|
|
varying vec2 v_texCoord;
|
|
|
|
|
|
|
|
uniform vec2 resolution;
|
2019-03-14 13:43:40 +08:00
|
|
|
uniform sampler2D u_texture;
|
2019-03-26 13:45:03 +08:00
|
|
|
uniform vec4 u_Time;
|
2014-05-05 13:27:47 +08:00
|
|
|
|
|
|
|
const float intensity = 0.05;
|
|
|
|
vec3 noise(vec2 uv)
|
|
|
|
{
|
2019-03-26 13:45:03 +08:00
|
|
|
vec2 p = abs(sin(uv * 13.0 + uv.x * u_Time[1] * sin(uv.y)));
|
2014-05-05 13:27:47 +08:00
|
|
|
|
2019-03-26 13:45:03 +08:00
|
|
|
return vec3(sin (0.2 * u_Time[1] + sin(p * 0.5) * u_Time[1] / cos(50.0)) * 10.0,0.3+0.5 * abs(sin(u_Time[1] * tan(5.0))));
|
2014-05-05 13:27:47 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void main(void)
|
|
|
|
{
|
2019-03-26 13:45:03 +08:00
|
|
|
gl_FragColor.xyz = intensity * noise(gl_FragCoord.xy / sin(resolution.xy * u_Time[1] * 0.01)) + (1. - intensity) *
|
2019-03-14 13:43:40 +08:00
|
|
|
texture2D(u_texture,v_texCoord.xy).xyz;
|
2014-05-05 13:27:47 +08:00
|
|
|
gl_FragColor.w = 1.;
|
|
|
|
}
|