1.圆环
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
// Normalized pixel coordinates (from 0 to 1)
vec2 uv = fragCoord/iResolution.xy;
uv -= 0.5;
//将uv的x坐标进行放大
uv.x *= iResolution.x / iResolution.y;
//到(0.0,0.0)的距离
float d = length(uv);
float c = fract(d * 10.0);
fragColor = vec4(vec3(c),1.0);
}
效果:
2.四象限
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
// Normalized pixel coordinates (from 0 to 1)
vec2 uv = fragCoord/iResolution.xy;
uv -= 0.5;
//将uv的x坐标进行放大
uv.x *= iResolution.x / iResolution.y;
//到(0.3,0.3)的距离
float d = length(abs(uv) - 0.3);
float c = fract(d * 10.0);
fragColor = vec4(vec3(c),1.0);
}
效果: