shader 圆

float circle(in vec2 st, in float r, in float blur){
    float d = distance(st, vec2(.5));
    float t = smoothstep(r,r+blur,d);;
    return t;
}

void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
    // Normalized pixel coordinates (from 0 to 1)
    vec2 uv = fragCoord.xy/iResolution.xy;
    uv.x *=  iResolution.x/iResolution.y;
    //uv.x -= .5;
    vec3 col = vec3(0.);
    
    col = vec3(circle(uv, .2, 0.01));

    // Output to screen
    fragColor = vec4(col,1.0);
}
posted @ 2022-06-23 23:35  卑面派对  阅读(25)  评论(0编辑  收藏  举报