ARUINormal.shader 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. Shader "Unlit/ARUI/Normal"
  2. {
  3. Properties
  4. {
  5. _MainTex("Texture", 2D) = "white" {}
  6. _Color("Main Color", Color) = (1,1,1,1)
  7. _Radius("Radius", Range(0, 1)) = 0.5
  8. _Thickness("Thickness", Range(0, 1)) = 0.02
  9. _Angle("Angle", Range(0, 1)) = 0
  10. }
  11. SubShader
  12. {
  13. Tags { "Queue" = "Transparent" "IngnoreProjector" = "True" "RenderType" = "Transparent" }
  14. LOD 200
  15. Pass
  16. {
  17. ZWrite Off
  18. Cull Off
  19. Blend SrcAlpha OneMinusSrcAlpha
  20. CGPROGRAM
  21. #pragma vertex vert
  22. #pragma fragment frag
  23. // make fog work
  24. #pragma multi_compile_fog
  25. #include "UnityCG.cginc"
  26. struct appdata
  27. {
  28. float4 vertex : POSITION;
  29. float2 uv : TEXCOORD0;
  30. };
  31. struct v2f
  32. {
  33. float2 uv : TEXCOORD0;
  34. UNITY_FOG_COORDS(1)
  35. float4 vertex : SV_POSITION;
  36. };
  37. sampler2D _MainTex;
  38. fixed4 _Color;
  39. float4 _MainTex_ST;
  40. float _Radius, _Thickness, _Angle;
  41. v2f vert(appdata v)
  42. {
  43. v2f o;
  44. o.vertex = UnityObjectToClipPos(v.vertex);
  45. o.uv = TRANSFORM_TEX(v.uv, _MainTex);
  46. o.uv.x = 1.0 - o.uv.x;
  47. //UNITY_TRANSFER_FOG(o,o.vertex);
  48. return o;
  49. }
  50. fixed4 frag(v2f i) : SV_Target
  51. {
  52. // sample the texture
  53. float alpha = 1.0f;
  54. fixed4 col = tex2D(_MainTex, i.uv) * _Color;
  55. //float dis = (i.uv.x - 0.5) * (i.uv.x - 0.5) + (i.uv.y - 0.5) * (i.uv.y - 0.5);
  56. //if (dis<_Radius)
  57. //{
  58. // //col.a = 1.0;
  59. // //clip(-1);
  60. //}
  61. //else if (dis > _Radius + _Thickness)
  62. //{
  63. // col.a = 0.0;
  64. // clip(-1);
  65. //}
  66. /*else {
  67. float angletemp = atan2(i.uv.y - 0.5, i.uv.x - 0.5);
  68. if (angletemp < (_Angle - 0.5) * 3.1415926 * 2)
  69. {
  70. col.a = 0.0;
  71. clip(-1);
  72. }
  73. else {
  74. col.a = (_Thickness * 0.5 - abs(dis - _Radius - _Thickness * 0.5)) / 0.008;
  75. }
  76. }*/
  77. // apply fog
  78. //UNITY_APPLY_FOG(i.fogCoord, col);
  79. return col;
  80. }
  81. ENDCG
  82. }
  83. }
  84. }