1 篇文章 0 订阅


float circle(vec2 p,float r)
{
float c=(length(p/r)-1.0)*500.0;
float d=1.0-smoothstep(0.0,1.0,c*0.04);
return d;
}
float line(vec2 pos,vec2 point1,vec2 point2)
{
float k = (point1.y - point2.y)/(point1.x - point2.x);
float b = point1.y - k * point1.x;
float d = abs(k * pos.x - pos.y + b) / sqrt(k * k + 1.0);
float t = 1.0-smoothstep(0.005/2.0, 0.005/2.0 + 0.001, d);
return t;
}
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{    //
vec2 uv = fragCoord.xy / iResolution.xy;
vec2 p = (fragCoord.xy - 0.5*iResolution.xy)/iResolution.y;
vec3 layer0 = vec3(0.2235, 0.7725, 0.0863);
float r=0.1;//半径
//画园
float a=circle(p,r);
vec3 color=vec3(0.2353, 0.0824, 0.4314);
color+=layer0*a;
vec2 point1=vec2(0.2,0.4);
vec2 point2=vec2(-0.2,0.3);
//两点
float c1=circle(p-point1,0.005);
float c2=circle(p-point2,0.005);
color+=c1*layer0;
color+=c2*layer0;
//直线
float c3=line(p,point1,point2);
color+=c3*vec3(0.8784, 0.0667, 0.0667);
fragColor=vec4(color,1.0)
}


• 0
点赞
• 2
收藏
• 打赏
• 1
评论
09-18 3207
11-01 155
03-16 2854
05-16 3370
03-22 6924
04-26 3362
03-27 361
06-05 1689
07-30 1361
04-10 1847
10-27 819
05-31 1503

### “相关推荐”对你有帮助么？

• 非常没帮助
• 没帮助
• 一般
• 有帮助
• 非常有帮助

mr.chenyuelin

¥2 ¥4 ¥6 ¥10 ¥20

1.余额是钱包充值的虚拟货币，按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载，可以购买VIP、C币套餐、付费专栏及课程。