Put rounded corners on a plane

I am trying to get rounded corners on a plane. The plane is a rectangle.

https://jsfiddle.net/zero0zero/40xb1yjq/

This shadertoy example has the rounded corners, but I have not been able to make its method(s) work for my use case:

Also, it would be nice if the rectangle shape itself was generated in the shader, giving it antialiased edges.

1 Like