You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

191 lines
9.0 KiB

  1. // Made with Amplify Shader Editor
  2. // Available at the Unity Asset Store - http://u3d.as/y3X
  3. Shader "ASESampleShaders/Sprites/UISpriteFX"
  4. {
  5. Properties
  6. {
  7. [PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
  8. _Color ("Tint", Color) = (1,1,1,1)
  9. [MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
  10. [PerRendererData] _AlphaTex ("External Alpha", 2D) = "white" {}
  11. [Header(UI Sprite Effect Layer)]
  12. _RingColor("Ring Color", Color) = (0,0.3793104,1,1)
  13. [NoScaleOffset]_Ring("Ring", 2D) = "white" {}
  14. [HideInInspector]_CustomUVS("CustomUVS", Vector) = (0,0,0,0)
  15. _Vector1("Vector 1", Vector) = (0,0,0,0)
  16. [HideInInspector] _texcoord( "", 2D ) = "white" {}
  17. }
  18. SubShader
  19. {
  20. Tags
  21. {
  22. "Queue"="Transparent"
  23. "IgnoreProjector"="True"
  24. "RenderType"="Transparent"
  25. "PreviewType"="Plane"
  26. "CanUseSpriteAtlas"="True"
  27. }
  28. Cull Off
  29. Lighting Off
  30. ZWrite Off
  31. Blend One OneMinusSrcAlpha
  32. Pass
  33. {
  34. CGPROGRAM
  35. #pragma vertex vert
  36. #pragma fragment frag
  37. #pragma target 3.0
  38. #pragma multi_compile _ PIXELSNAP_ON
  39. #pragma multi_compile _ ETC1_EXTERNAL_ALPHA
  40. #include "UnityCG.cginc"
  41. #include "UnityShaderVariables.cginc"
  42. struct appdata_t
  43. {
  44. float4 vertex : POSITION;
  45. float4 color : COLOR;
  46. float2 texcoord : TEXCOORD0;
  47. UNITY_VERTEX_INPUT_INSTANCE_ID
  48. };
  49. struct v2f
  50. {
  51. float4 vertex : SV_POSITION;
  52. fixed4 color : COLOR;
  53. float2 texcoord : TEXCOORD0;
  54. UNITY_VERTEX_OUTPUT_STEREO
  55. };
  56. uniform fixed4 _Color;
  57. uniform float _EnableExternalAlpha;
  58. uniform sampler2D _MainTex;
  59. uniform sampler2D _AlphaTex;
  60. uniform float4 _MainTex_ST;
  61. uniform float4 _RingColor;
  62. uniform sampler2D _Ring;
  63. uniform float4 _CustomUVS;
  64. uniform float4 _Vector1;
  65. v2f vert( appdata_t IN )
  66. {
  67. v2f OUT;
  68. UNITY_SETUP_INSTANCE_ID(IN);
  69. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);
  70. IN.vertex.xyz += float3(0,0,0) ;
  71. OUT.vertex = UnityObjectToClipPos(IN.vertex);
  72. OUT.texcoord = IN.texcoord;
  73. OUT.color = IN.color * _Color;
  74. #ifdef PIXELSNAP_ON
  75. OUT.vertex = UnityPixelSnap (OUT.vertex);
  76. #endif
  77. return OUT;
  78. }
  79. fixed4 SampleSpriteTexture (float2 uv)
  80. {
  81. fixed4 color = tex2D (_MainTex, uv);
  82. #if ETC1_EXTERNAL_ALPHA
  83. // get the color from an external texture (usecase: Alpha support for ETC1 on android)
  84. fixed4 alpha = tex2D (_AlphaTex, uv);
  85. color.a = lerp (color.a, alpha.r, _EnableExternalAlpha);
  86. #endif //ETC1_EXTERNAL_ALPHA
  87. return color;
  88. }
  89. fixed4 frag(v2f IN ) : SV_Target
  90. {
  91. float2 uv_MainTex = IN.texcoord.xy * _MainTex_ST.xy + _MainTex_ST.zw;
  92. float4 tex2DNode30 = tex2D( _MainTex, uv_MainTex );
  93. float2 appendResult54 = (float2((0.0 + (uv_MainTex.x - _CustomUVS.x) * (1.0 - 0.0) / (_CustomUVS.z - _CustomUVS.x)) , (0.0 + (uv_MainTex.y - _CustomUVS.y) * (1.0 - 0.0) / (_CustomUVS.w - _CustomUVS.y))));
  94. float4 appendResult65 = (float4(_Vector1.x , ( _Vector1.y * _SinTime.w ) , _Vector1.z , _Vector1.w));
  95. float4 temp_output_57_0_g9 = appendResult65;
  96. float2 temp_output_2_0_g9 = (temp_output_57_0_g9).zw;
  97. float2 temp_cast_0 = (1.0).xx;
  98. float2 temp_output_13_0_g9 = ( ( ( appendResult54 + (temp_output_57_0_g9).xy ) * temp_output_2_0_g9 ) + -( ( temp_output_2_0_g9 - temp_cast_0 ) * 0.5 ) );
  99. float TimeVar197_g9 = _Time.y;
  100. float cos17_g9 = cos( TimeVar197_g9 );
  101. float sin17_g9 = sin( TimeVar197_g9 );
  102. float2 rotator17_g9 = mul( temp_output_13_0_g9 - float2( 0.5,0.5 ) , float2x2( cos17_g9 , -sin17_g9 , sin17_g9 , cos17_g9 )) + float2( 0.5,0.5 );
  103. float4 tex2DNode97_g9 = tex2D( _Ring, rotator17_g9 );
  104. float2 temp_cast_1 = (1.0).xx;
  105. float temp_output_115_0_g9 = step( ( (temp_output_13_0_g9).y + -0.5 ) , 0.0 );
  106. float lerpResult125_g9 = lerp( 1.0 , ( 1.0 - tex2DNode30.a ) , ( 1.0 - temp_output_115_0_g9 ));
  107. float4 lerpResult59 = lerp( tex2DNode30 , _RingColor , (( tex2DNode97_g9 * lerpResult125_g9 * tex2DNode97_g9.a )).a);
  108. fixed4 c = lerpResult59;
  109. c.rgb *= c.a;
  110. return c;
  111. }
  112. ENDCG
  113. }
  114. }
  115. CustomEditor "ASEMaterialInspector"
  116. }
  117. /*ASEBEGIN
  118. Version=14301
  119. 487;594;979;424;4561.382;933.7484;5.50167;True;False
  120. Node;AmplifyShaderEditor.TemplateShaderPropertyNode;29;-2528,-208;Float;False;_MainTex;0;5;SAMPLER2D;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  121. Node;AmplifyShaderEditor.CommentaryNode;66;-1168,608;Float;False;745;437;Comment;4;32;63;64;65;Wavy Ring;1,1,1,1;0;0
  122. Node;AmplifyShaderEditor.CommentaryNode;61;-2138.606,153.7167;Float;False;797.0422;558.1058;Comment;7;57;55;50;51;52;53;54;Remap Sprite UVs;1,1,1,1;0;0
  123. Node;AmplifyShaderEditor.Vector4Node;55;-2058.288,332.4499;Float;False;Property;_CustomUVS;CustomUVS;9;1;[HideInInspector];Create;True;0,0,0,0;0,0,0.5,1;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  124. Node;AmplifyShaderEditor.TextureCoordinatesNode;57;-2088.606,203.7167;Float;False;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  125. Node;AmplifyShaderEditor.RangedFloatNode;51;-2026.44,596.8225;Float;False;Constant;_Float2;Float 2;4;0;Create;True;1;0;0;0;0;1;FLOAT;0
  126. Node;AmplifyShaderEditor.RangedFloatNode;50;-2026.838,506.8231;Float;False;Constant;_Float1;Float 1;4;0;Create;True;0;0;0;0;0;1;FLOAT;0
  127. Node;AmplifyShaderEditor.Vector4Node;32;-1120,656;Float;False;Property;_Vector1;Vector 1;10;0;Create;True;0,0,0,0;0,-0.06,0.98,2.54;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  128. Node;AmplifyShaderEditor.SinTimeNode;63;-1056,864;Float;False;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  129. Node;AmplifyShaderEditor.TFHCRemapNode;53;-1741.042,270.4898;Float;False;5;0;FLOAT;0.0;False;1;FLOAT;0.0;False;2;FLOAT;1.0;False;3;FLOAT;0.0;False;4;FLOAT;1.0;False;1;FLOAT;0
  130. Node;AmplifyShaderEditor.TFHCRemapNode;52;-1746.327,470.5828;Float;False;5;0;FLOAT;0.0;False;1;FLOAT;0.0;False;2;FLOAT;1.0;False;3;FLOAT;0.0;False;4;FLOAT;1.0;False;1;FLOAT;0
  131. Node;AmplifyShaderEditor.CommentaryNode;67;-1042,-98;Float;False;1151;592;Comment;4;31;36;58;60;Rotation FX;0,1,0.1310346,1;0;0
  132. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;64;-736,816;Float;False;2;2;0;FLOAT;0.0;False;1;FLOAT;0.0;False;1;FLOAT;0
  133. Node;AmplifyShaderEditor.SamplerNode;30;-1360,-224;Float;True;Property;_TextureSample0;Texture Sample 0;1;0;Create;True;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0.0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1.0;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  134. Node;AmplifyShaderEditor.DynamicAppendNode;65;-592,688;Float;False;FLOAT4;4;0;FLOAT;0.0;False;1;FLOAT;0.0;False;2;FLOAT;0.0;False;3;FLOAT;0.0;False;1;FLOAT4;0
  135. Node;AmplifyShaderEditor.DynamicAppendNode;54;-1520,400;Float;False;FLOAT2;4;0;FLOAT;0.0;False;1;FLOAT;0.0;False;2;FLOAT;0.0;False;3;FLOAT;0.0;False;1;FLOAT2;0
  136. Node;AmplifyShaderEditor.OneMinusNode;36;-960,384;Float;False;1;0;FLOAT;0.0;False;1;FLOAT;0
  137. Node;AmplifyShaderEditor.TexturePropertyNode;31;-992,80;Float;True;Property;_Ring;Ring;8;1;[NoScaleOffset];Create;True;None;ce384aed77a765144bdb41c367961753;False;white;Auto;0;1;SAMPLER2D;0
  138. Node;AmplifyShaderEditor.FunctionNode;71;-400,144;Float;False;UI-Sprite Effect Layer;0;;9;789bf62641c5cfe4ab7126850acc22b8;17,74,2,191,0,225,1,242,0,237,1,249,0,186,0,177,0,182,0,229,0,92,0,98,1,234,0,126,1,129,1,130,1,31,0;18;192;COLOR;1,1,1,1;False;39;COLOR;1,1,1,1;False;37;SAMPLER2D;;False;218;FLOAT2;0,0;False;239;FLOAT2;0,0;False;181;FLOAT2;0,0;False;75;SAMPLER2D;;False;80;FLOAT;1.0;False;183;FLOAT2;0,0;False;188;SAMPLER2D;;False;33;SAMPLER2D;;False;248;FLOAT2;0,0;False;233;SAMPLER2D;;False;101;SAMPLER2D;;False;57;FLOAT4;0,0,0,0;False;40;FLOAT;0.0;False;231;FLOAT;1.0;False;30;FLOAT;1.0;False;2;COLOR;0;FLOAT2;172
  139. Node;AmplifyShaderEditor.ColorNode;58;-368,-48;Float;False;Property;_RingColor;Ring Color;7;0;Create;True;0,0.3793104,1,1;0,1,0.3793103,1;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  140. Node;AmplifyShaderEditor.ComponentMaskNode;60;-128,128;Float;False;False;False;False;True;1;0;COLOR;0,0,0,0;False;1;FLOAT;0
  141. Node;AmplifyShaderEditor.LerpOp;59;176,-208;Float;False;3;0;COLOR;0,0,0,0;False;1;COLOR;0.0,0,0,0;False;2;FLOAT;0.0,0,0,0;False;1;COLOR;0
  142. Node;AmplifyShaderEditor.TemplateMasterNode;27;336,-208;Float;False;True;2;Float;ASEMaterialInspector;0;4;ASESampleShaders/Sprites/UISpriteFX;0f8ba0101102bb14ebf021ddadce9b49;Sprites Default;3;One;OneMinusSrcAlpha;0;One;Zero;Off;2;2;0;FLOAT4;0,0,0,0;False;1;FLOAT3;0,0,0;False;0
  143. WireConnection;57;2;29;0
  144. WireConnection;53;0;57;2
  145. WireConnection;53;1;55;2
  146. WireConnection;53;2;55;4
  147. WireConnection;53;3;50;0
  148. WireConnection;53;4;51;0
  149. WireConnection;52;0;57;1
  150. WireConnection;52;1;55;1
  151. WireConnection;52;2;55;3
  152. WireConnection;52;3;50;0
  153. WireConnection;52;4;51;0
  154. WireConnection;64;0;32;2
  155. WireConnection;64;1;63;4
  156. WireConnection;30;0;29;0
  157. WireConnection;65;0;32;1
  158. WireConnection;65;1;64;0
  159. WireConnection;65;2;32;3
  160. WireConnection;65;3;32;4
  161. WireConnection;54;0;52;0
  162. WireConnection;54;1;53;0
  163. WireConnection;36;0;30;4
  164. WireConnection;71;37;31;0
  165. WireConnection;71;239;54;0
  166. WireConnection;71;57;65;0
  167. WireConnection;71;30;36;0
  168. WireConnection;60;0;71;0
  169. WireConnection;59;0;30;0
  170. WireConnection;59;1;58;0
  171. WireConnection;59;2;60;0
  172. WireConnection;27;0;59;0
  173. ASEEND*/
  174. //CHKSM=C27FB932634DAAD47698A43833F942B905FE1D53