Shader "Custom/GroundCircle"
{
Properties {
_Color("Color", Color) = (1,1,1,1)
_MainTex("Albedo (RGB)", 2D) = "white" {}
_Center("Center", Vector) = (0,0,0,0)//圆的中心
_Radius("Radius", Float) = 0.5//圆的半径
_RadiusColor("Radius Color", Color) = (1,0,0,1)//圆的颜色
_RadiusWidth("Radius Width", Float) = 2//圆的宽度
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf Standard fullforwardshadows
#pragma target 3.0
sampler2D _MainTex;
fixed4 _Color;
float3 _Center;
float _Radius;
fixed4 _RadiusColor;
float _RadiusWidth;
struct Input {
float2 uv_MainTex;
float3 worldPos;
};
void surf(Input IN, inout SurfaceOutputStandard o) {
float d = distance(_Center, IN.worldPos);
if (d > _Radius && d < _Radius + _RadiusWidth)
o.Albedo = _RadiusColor;
else
o.Albedo = tex2D(_MainTex, IN.uv_MainTex).rgb;
}
ENDCG
}
FallBack "Diffuse"
}
Shader——地上画圆效果
猜你喜欢
转载自blog.csdn.net/LLLLL__/article/details/105098371
今日推荐
周排行