GLSL图形(一)
precision lowp float;
varying vec2 vUv;
void main(){
gl_FragColor =vec4(vUv,0,1);
}
precision lowp float;
varying vec2 vUv;
void main(){
gl_FragColor =vec4(vUv,1,1);
}
precision lowp float;
varying vec2 vUv;
void main(){
float strength = vUv.x;
gl_FragColor =vec4(strength,strength,strength,1);
}
precision lowp float;
varying vec2 vUv;
void main(){
float strength = vUv.y;
gl_FragColor =vec4(strength,strength,strength,1);
}
precision lowp float;
varying vec2 vUv;
void main(){
float strength = 1.0-vUv.y;
gl_FragColor =vec4(strength,strength,strength,1);
}
precision lowp float;
varying vec2 vUv;
void main(){
//利用uv实现短范围内渐变
float strength = vUv.y * 10.0;
gl_FragColor =vec4(strength,strength,strength,1);
}
precision lowp float;
varying vec2 vUv;
void main(){
//7利用通过取模达到反复效果
float strength = mod(vUv.y * 10.0 , 1.0) ;
gl_FragColor =vec4(strength,strength,strength,1);
}
precision lowp float;
varying vec2 vUv;
void main(){
//8利用step(edge, x)如果x < edge,返回0.0,否则返回1.0
float strength = mod(vUv.y * 10.0 , 1.0) ;
strength = step(0.5,strength);
gl_FragColor =vec4(strength,strength,strength,1);
}
precision lowp float;
varying vec2 vUv;
void main(){
//9利用step(edge, x)如果x < edge,返回0.0,否则返回1.0
float strength = mod(vUv.y * 10.0 , 1.0) ;
strength = step(0.8,strength);
gl_FragColor =vec4(strength,strength,strength,1);
}
precision lowp float;
varying vec2 vUv;
void main(){
//10利用step(edge, x)如果x < edge,返回0.0,否则返回1.0
float strength = mod(vUv.x * 10.0 , 1.0) ;
strength = step(0.8,strength);
gl_FragColor =vec4(strength,strength,strength,1);
}
precision lowp float;
varying vec2 vUv;
void main(){
// 11条纹相加
float strength = step(0.8, mod(vUv.x * 10.0 , 1.0)) ;
strength += step(0.8, mod(vUv.y * 10.0 , 1.0)) ;
gl_FragColor =vec4(strength,strength,strength,1);
}
precision lowp float;
varying vec2 vUv;
void main(){
// 12条纹相乘
float strength = step(0.8, mod(vUv.x * 10.0 , 1.0)) ;
strength *= step(0.8, mod(vUv.y * 10.0 , 1.0)) ;
gl_FragColor =vec4(strength,strength,strength,1);
}
precision lowp float;
varying vec2 vUv;
void main(){
// 13条纹相减
float strength = step(0.8, mod(vUv.x * 10.0 , 1.0)) ;
strength -= step(0.8, mod(vUv.y * 10.0 , 1.0)) ;
gl_FragColor =vec4(strength,strength,strength,1);
}
precision lowp float;
varying vec2 vUv;
void main(){
// 14方块图形
float strength = step(0.2, mod(vUv.x * 10.0 , 1.0)) ;
strength *= step(0.2, mod(vUv.y * 10.0 , 1.0)) ;
gl_FragColor =vec4(strength,strength,strength,1);
}
precision lowp float;
uniform float uTime;
varying vec2 vUv;
void main(){
float barX = step(0.4, mod((vUv.x+uTime*0.1) * 10.0 , 1.0))*step(0.8, mod(vUv.y * 10.0 , 1.0)) ;
float barX = step(0.4, mod(vUv.x * 10.0 - 0.2 , 1.0))*step(0.8, mod(vUv.y * 10.0 , 1.0)) ;
float barY = step(0.4, mod(vUv.y * 10.0 , 1.0))*step(0.8, mod(vUv.x * 10.0 , 1.0)) ;
float strength = barX+barY;
gl_FragColor =vec4(strength,strength,strength,1);
}
precision lowp float;
uniform float uTime;
varying vec2 vUv;
void main(){
float barX = step(0.4, mod((vUv.x+uTime*0.1) * 10.0 , 1.0))*step(0.8, mod(vUv.y * 10.0 , 1.0)) ;
float barX = step(0.4, mod(vUv.x * 10.0 - 0.2 , 1.0))*step(0.8, mod(vUv.y * 10.0 , 1.0)) ;
float barY = step(0.4, mod(vUv.y * 10.0 , 1.0))*step(0.8, mod(vUv.x * 10.0 , 1.0)) ;
float strength = barX+barY;
gl_FragColor = vec4(vUv,1,strength);
}
Powered by Waline v2.13.0