1.黑白的
#define time iTime*10.
float stripe(vec2 uv) {
//相当于先旋转坐标系,再映射到波形图到z
return cos((uv.x * 45.0-time+uv.y*-10.) * 0.1);
}
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
vec2 uv = fragCoord.xy / iResolution.xy;
float a = iResolution.x/iResolution.y;
uv.x *= a;
float g = stripe(uv);
fragColor = vec4(vec3(g),1.0);
}
效果:
2.加上贴图的
#define time iTime*10.
float stripe(vec2 uv) {
//相当于先旋转坐标系,再映射到波形图到z
return cos((uv.x * 45.0-time+uv.y*-10.) * 0.1);
}
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
vec2 uv = fragCoord.xy / iResolution.xy;
float a = iResolution.x/iResolution.y;
uv.x *= a;
vec4 tcolor = texture(iChannel0, uv);
float t = stripe(uv);
t = clamp(t,0.0,1.0);
tcolor += t;
fragColor = tcolor;
}
效果: