其他分享
首页 > 其他分享> > shader 圆

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);
}

标签:float,uv,shader,iResolution,vec2,vec3,col
来源: https://www.cnblogs.com/gongxiansheng/p/16407229.html