Pass
{
CGPROGRAM
// Upgrade NOTE: excluded shader from OpenGL ES 2.0 because it does not contain a surface program or both vertex and fragment programs.
#pragma exclude_renderers gles #pragma fragment frag
#include "UnityCG.cginc" sampler2D _MainTex;
float4 _MainColor;
float _RoundRadius; struct texCoord
{
float2 inputTexCoord : TEXCOORD0;
}; float4 frag(texCoord input) : COLOR
{
float x = input.inputTexCoord.x;
float y = input.inputTexCoord.y;
float4 col = tex2D(_MainTex,input.inputTexCoord)*_MainColor; float radius = _RoundRadius; if(x<radius && y<radius)
{
if(pow(x-radius,)+pow(y-radius,)>radius*radius)
{
discard;
}
}
else if(x>-radius && y>-radius)
{
if(pow(x-(-radius),)+pow(y-(-radius),)>radius*radius)
{
discard;
}
}
else if(x<radius && y>-radius)
{
if(pow(x-radius,)+pow(y-(-radius),)>radius*radius)
{
discard;
}
} else if(x>-radius && y<radius)
{
if(pow(x-(-radius),)+pow(y-radius,)>radius*radius)
{
discard;
}
} return col;
} ENDCG
}
效果图