Guest User

Untitled

a guest
Dec 17th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.14 KB | None | 0 0
  1. waitfor 2 second
  2. flash effect
  3. waitfor 2 second
  4. flash effect
  5. ....
  6.  
  7. Shader "TrueDream/SwordFlash" {
  8. Properties {
  9. _MainTex("MainTex",2D) = "white"{}
  10. _Color ("Color", Color) = (1,1,1,1)
  11. _LineColor ("LineColor", Color) = (1,1,0,1)
  12. _Speed ("Speed",Float) = 1
  13. _Thickness ("Thickness", Float) = 4.286548
  14. _LineSeparation ("LineSeparation", Range(0.1, 10)) = 1
  15. _LineRotation ("LineRotation", Range(-180, 180)) = 0
  16. _Numbers ("Numbers", Float ) = 1
  17. [MaterialToggle] _Enable ("Enable", Float ) = 1
  18. _Mask ("Mask", 2D) = "white" {}
  19. }
  20. SubShader {
  21. Tags {
  22. "IgnoreProjector"="True"
  23. "Queue"="Transparent"
  24. "RenderType"="Transparent"
  25. }
  26. ZWrite Off Blend SrcAlpha OneMinusSrcAlpha
  27.  
  28. Pass
  29. {
  30.  
  31. CGPROGRAM
  32. #pragma vertex vert
  33. #pragma fragment frag
  34. #pragma fragmentoption ARB_precision_hint_fastest
  35. #include "UnityCG.cginc"
  36.  
  37. struct VertexInput
  38. {
  39. float4 vertex : POSITION;
  40. float2 uv : TEXCOORD0;
  41. };
  42.  
  43. struct VertexOutput
  44. {
  45. float4 vertex : SV_POSITION;
  46. half2 uv : TEXCOORD0;
  47. };
  48.  
  49. sampler2D _MainTex;
  50. float4 _MainTex_ST;
  51. fixed4 _Color;
  52. float _Speed;
  53. float _Numbers;
  54.  
  55.  
  56. VertexOutput vert(VertexInput v)
  57. {
  58. VertexOutput o;
  59. o.vertex = UnityObjectToClipPos(v.vertex);
  60. o.uv = TRANSFORM_TEX (v.uv, _MainTex);
  61. return o;
  62. }
  63.  
  64. float4 frag (VertexOutput i) : COLOR
  65. {
  66.  
  67. float2 uv = i.uv.xy;
  68. float4 tex = tex2D(_MainTex, uv);
  69.  
  70. return tex*_Color;
  71. }
  72. ENDCG
  73. }
  74.  
  75.  
  76. Tags {
  77. "IgnoreProjector"="True"
  78. "Queue"="Transparent"
  79. "RenderType"="Transparent"
  80. }
  81. Pass {
  82. Name "FORWARD"
  83. Tags {
  84. "LightMode"="ForwardBase"
  85. }
  86. Blend One One
  87. ZWrite Off
  88.  
  89. CGPROGRAM
  90. #pragma vertex vert
  91. #pragma fragment frag
  92. #define UNITY_PASS_FORWARDBASE
  93. #include "UnityCG.cginc"
  94. #pragma multi_compile_fwdbase
  95. #pragma only_renderers d3d9 d3d11 glcore gles n3ds wiiu
  96. #pragma target 3.0
  97. uniform float4 _TimeEditor;
  98. uniform float _LineAlpha;
  99. uniform float _Speed;
  100. uniform float _Thickness;
  101. uniform float _LineSeparation;
  102. uniform float _LineRotation;
  103. uniform float4 _LineColor;
  104. uniform float _Numbers;
  105. uniform fixed _Enable;
  106. uniform sampler2D _Mask; uniform float4 _Mask_ST;
  107. sampler2D _MainTex;
  108. struct VertexInput {
  109. float4 vertex : POSITION;
  110. float2 texcoord0 : TEXCOORD0;
  111. };
  112. struct VertexOutput {
  113. float4 pos : SV_POSITION;
  114. float2 uv0 : TEXCOORD0;
  115. };
  116. VertexOutput vert (VertexInput v) {
  117. VertexOutput o = (VertexOutput)0;
  118. o.uv0 = v.texcoord0;
  119. o.pos = UnityObjectToClipPos(v.vertex );
  120. return o;
  121. }
  122. float4 frag(VertexOutput i) : COLOR {
  123. float4 _Mask_var = tex2D(_Mask,TRANSFORM_TEX(i.uv0, _Mask));
  124. float node_9529_ang = (_LineRotation*0.01745333+0.0);
  125. float node_9529_spd = 1.0;
  126. float node_9529_cos = cos(node_9529_spd*node_9529_ang);
  127. float node_9529_sin = sin(node_9529_spd*node_9529_ang);
  128. float2 node_9529_piv = float2(0.5,0.5);
  129. float2 node_9529 = (mul(float2((i.uv0.r/_LineSeparation),(i.uv0.g/_LineSeparation))-node_9529_piv,float2x2( node_9529_cos, -node_9529_sin, node_9529_sin, node_9529_cos))+node_9529_piv);
  130. float4 node_5664 = _Time + _TimeEditor;
  131. float node_6322 = frac((_Numbers*(1.0 - (node_9529+(node_5664.g*_Speed))).g));
  132. float node_4443 = (pow(smoothstep( 0.5, 0.0, ((1.0 - node_6322)*node_6322) ),(35.0-_Thickness))*_LineColor.a);
  133. float3 emissive = lerp( ((node_4443*_LineColor.rgb)), 0.0, 1-_Enable )*_Mask_var.a;
  134. float3 finalColor = emissive;
  135. return fixed4(finalColor,1)*tex2D(_MainTex,i.uv0).a*_Mask_var.x;
  136. }
  137. ENDCG
  138. }
  139. }
  140. Fallback "Sprites/Default"
  141. }
Add Comment
Please, Sign In to add comment