SDF圆公式
阅读
2024-04-02更新
最新编辑:glamcurrent
阅读:
更新日期:2024-04-02
最新编辑:glamcurrent
[math]\displaystyle{ \begin{array}{l} (x-x_0)^2-(y-y_0)^2=R^2\\ 可变为:\\ \ \sqrt{(x-x_0)^2-(y-y_0)^2}=R\\ 左侧等同于length求模函数,将(x,y)设为point,原点偏移设为C有:\\ \ length(point-C)-R=0 \end{array} }[/math]
float Circle(in vec3 p, in vec3 c, float r)
{
return length(p - c) - r;
}