Shader"Unlit/newunlitshader"{Properties {_maintex ("Texture", 2D) =" White"{} _color ("Tint", Color) = (1,1,1,1) _stencilcomp ("stencil Comparison", Float) =8_stencil ("stencil ID", Float) =0_stencilop ("stencil Operation", Float) =0_stencilwritemask ("stencil Write Mask", Float) =255_stencilreadmask ("stencil Read Mask", Float) =255_colormask ("Color Mask", Float) = the_width ("_width", Float) =0} subshader {Tags {"Queue"="Transparent" "Ignoreprojector"="True" "Rendertype"="Transparent" "Previewtype"="Plane"} cull off Lighting off fog{Mode Off} Blend srcalpha Oneminussrcalpha Stencil {Ref[_stencil] comp[_stencilcomp] Pass[_stencilop] Readma Sk[_stencilreadmask] Writemask[_stencilwritemask]} Colormask[_colormask] Pass { Cgprogram#pragmaVertex vert#pragmaFragment Frag#include"Unitycg.cginc" structAppData {float4 vertex:position; FLOAT2 uv:texcoord0; }; structv2f {float2 uv:texcoord0; FLOAT4 vertex:sv_position; }; Sampler2d _maintex; FLOAT4 _maintex_st; float_width; FLOAT4 _color; v2f Vert (AppData v) {v2f o; O.vertex=Unityobjecttoclippos (V.vertex); O.uv=Transform_tex (V.UV, _maintex); returno; } fixed4 Frag (v2f i): sv_target {floatD = Distance (I.UV,FLOAT2 (0.5,0.5)); if(D <0.5-2/_width) {Discard; } if(D >0.5) {discard; } fixed4 Col=tex2d (_maintex, I.UV); returncol*_color; } ENDCG} }}
Unity3d Ugui Shader Draw a ring