通过Stencil实现
Shader "Unlit/M1"
{
Properties
{
_StartPos("StartPos",vector) = (0,0,0,0)
_TargetPos("TargetPos",vector) = (0,0,0,0)
_Radius("Radius",range(0,1)) = 0.1
_AxisY ("AxisY",vector) = (0,1,0,0)
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100
Blend SrcAlpha OneMinusSrcAlpha
Stencil
{
ref 1
comp always
Pass Replace
}
Pass
{
Cull Back
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
// make fog work
#pragma multi_compile_fog