Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shader "RadialTimer" {
- Properties {
- _Angle ("Angle", Range(0,180)) = 180
- _Color ("Color", Color) = (1,1,1,1)
- _InnerRadius ("Inner Radius", Range(0,1)) = 0
- }
- SubShader {
- Tags
- {
- "RenderType"="Transparent"
- "Queue"="Transparent"
- }
- Pass
- {
- Blend SrcAlpha OneMinusSrcAlpha
- ZWrite Off
- ZTest Always
- CGPROGRAM
- #pragma vertex vert
- #pragma fragment frag
- #include "UnityCG.cginc"
- fixed4 _Color;
- half _Angle;
- half _InnerRadius;
- struct v2f
- {
- float4 pos : SV_POSITION;
- half2 uv : TEXCOORD;
- };
- struct appdata
- {
- float4 vertex : POSITION;
- half2 texcoord : TEXCOORD;
- };
- v2f vert (appdata v)
- {
- v2f o;
- o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
- o.uv = v.texcoord;
- return o;
- }
- fixed4 frag (v2f o) : COLOR
- {
- fixed4 col = _Color;
- fixed2 uv = o.uv - float2(0.5,0.5);
- fixed uvLength = length(uv);
- col.a = col.a
- //Cut off inner radius
- * ceil(uvLength - _InnerRadius)
- //Cut off outer radius
- * ceil( 1 - abs(uvLength / 0.5) )
- //Cut off angle
- * ceil( dot(fixed2(-1,0), normalize(uv) ) - (1 - (_Angle / 180)) );
- return col;
- }
- ENDCG
- }
- }
- FallBack "Diffuse"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement