GD_UniversalPremultiplited.shader 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. // Made with Amplify Shader Editor
  2. // Available at the Unity Asset Store - http://u3d.as/y3X
  3. Shader "GD/Particles/UniversalPremultiplitedFlipbookDistortion"
  4. {
  5. Properties
  6. {
  7. _TintColor ("Tint Color", Color) = (0.5,0.5,0.5,0.5)
  8. _MainTex ("Particle Texture", 2D) = "white" {}
  9. _InvFade ("Soft Particles Factor", Range(0.01,3.0)) = 1.0
  10. _Flipbook("Flipbook", 2D) = "white" {}
  11. _Tex1("Tex1", 2D) = "white" {}
  12. _Add_Blend("Add_Blend", Range( 0 , 4)) = 0
  13. _SpeedTex1("Speed Tex1", Vector) = (0.21,0.12,-0.06,-0.36)
  14. _Distortion("Distortion", Float) = -0.13
  15. _Wave("Wave", Float) = 1.53
  16. _Colums("Colums", Float) = 0
  17. _Rows("Rows", Float) = 0
  18. _StartFrame("StartFrame", Float) = 0
  19. _Time1("Time1", Float) = 0
  20. _Speed("Speed", Float) = 0
  21. _EmissionKek("EmissionKek", Float) = 0
  22. }
  23. Category
  24. {
  25. SubShader
  26. {
  27. LOD 0
  28. Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" }
  29. Blend One OneMinusSrcAlpha
  30. ColorMask RGB
  31. Cull Off
  32. Lighting Off
  33. ZWrite Off
  34. ZTest LEqual
  35. Pass {
  36. CGPROGRAM
  37. #ifndef UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX
  38. #define UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input)
  39. #endif
  40. #pragma vertex vert
  41. #pragma fragment frag
  42. #pragma target 2.0
  43. #pragma multi_compile_instancing
  44. #pragma multi_compile_particles
  45. #pragma multi_compile_fog
  46. #include "UnityShaderVariables.cginc"
  47. #define ASE_NEEDS_FRAG_COLOR
  48. #include "UnityCG.cginc"
  49. struct appdata_t
  50. {
  51. float4 vertex : POSITION;
  52. fixed4 color : COLOR;
  53. float4 texcoord : TEXCOORD0;
  54. UNITY_VERTEX_INPUT_INSTANCE_ID
  55. };
  56. struct v2f
  57. {
  58. float4 vertex : SV_POSITION;
  59. fixed4 color : COLOR;
  60. float4 texcoord : TEXCOORD0;
  61. UNITY_FOG_COORDS(1)
  62. #ifdef SOFTPARTICLES_ON
  63. float4 projPos : TEXCOORD2;
  64. #endif
  65. UNITY_VERTEX_INPUT_INSTANCE_ID
  66. UNITY_VERTEX_OUTPUT_STEREO
  67. };
  68. #if UNITY_VERSION >= 560
  69. UNITY_DECLARE_DEPTH_TEXTURE( _CameraDepthTexture );
  70. #else
  71. uniform sampler2D_float _CameraDepthTexture;
  72. #endif
  73. //Don't delete this comment
  74. // uniform sampler2D_float _CameraDepthTexture;
  75. uniform sampler2D _MainTex;
  76. uniform fixed4 _TintColor;
  77. uniform float4 _MainTex_ST;
  78. uniform float _InvFade;
  79. uniform sampler2D _Flipbook;
  80. uniform float _Colums;
  81. uniform float _Rows;
  82. uniform float _Speed;
  83. uniform float _StartFrame;
  84. uniform float _Time1;
  85. uniform sampler2D _Tex1;
  86. uniform float4 _SpeedTex1;
  87. uniform float _Wave;
  88. uniform float _Distortion;
  89. uniform float _EmissionKek;
  90. uniform float _Add_Blend;
  91. v2f vert ( appdata_t v )
  92. {
  93. v2f o;
  94. UNITY_SETUP_INSTANCE_ID(v);
  95. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
  96. UNITY_TRANSFER_INSTANCE_ID(v, o);
  97. v.vertex.xyz += float3( 0, 0, 0 ) ;
  98. o.vertex = UnityObjectToClipPos(v.vertex);
  99. #ifdef SOFTPARTICLES_ON
  100. o.projPos = ComputeScreenPos (o.vertex);
  101. COMPUTE_EYEDEPTH(o.projPos.z);
  102. #endif
  103. o.color = v.color;
  104. o.texcoord = v.texcoord;
  105. UNITY_TRANSFER_FOG(o,o.vertex);
  106. return o;
  107. }
  108. fixed4 frag ( v2f i ) : SV_Target
  109. {
  110. UNITY_SETUP_INSTANCE_ID( i );
  111. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( i );
  112. #ifdef SOFTPARTICLES_ON
  113. float sceneZ = LinearEyeDepth (SAMPLE_DEPTH_TEXTURE_PROJ(_CameraDepthTexture, UNITY_PROJ_COORD(i.projPos)));
  114. float partZ = i.projPos.z;
  115. float fade = saturate (_InvFade * (sceneZ-partZ));
  116. i.color.a *= fade;
  117. #endif
  118. float2 uv0123 = i.texcoord.xy * float2( 1,1 ) + float2( 0,0 );
  119. // *** BEGIN Flipbook UV Animation vars ***
  120. // Total tiles of Flipbook Texture
  121. float fbtotaltiles147 = _Colums * _Rows;
  122. // Offsets for cols and rows of Flipbook Texture
  123. float fbcolsoffset147 = 1.0f / _Colums;
  124. float fbrowsoffset147 = 1.0f / _Rows;
  125. // Speed of animation
  126. float fbspeed147 = _Time1 * _Speed;
  127. // UV Tiling (col and row offset)
  128. float2 fbtiling147 = float2(fbcolsoffset147, fbrowsoffset147);
  129. // UV Offset - calculate current tile linear index, and convert it to (X * coloffset, Y * rowoffset)
  130. // Calculate current tile linear index
  131. float fbcurrenttileindex147 = round( fmod( fbspeed147 + _StartFrame, fbtotaltiles147) );
  132. fbcurrenttileindex147 += ( fbcurrenttileindex147 < 0) ? fbtotaltiles147 : 0;
  133. // Obtain Offset X coordinate from current tile linear index
  134. float fblinearindextox147 = round ( fmod ( fbcurrenttileindex147, _Colums ) );
  135. // Multiply Offset X by coloffset
  136. float fboffsetx147 = fblinearindextox147 * fbcolsoffset147;
  137. // Obtain Offset Y coordinate from current tile linear index
  138. float fblinearindextoy147 = round( fmod( ( fbcurrenttileindex147 - fblinearindextox147 ) / _Colums, _Rows ) );
  139. // Reverse Y to get tiles from Top to Bottom
  140. fblinearindextoy147 = (int)(_Rows-1) - fblinearindextoy147;
  141. // Multiply Offset Y by rowoffset
  142. float fboffsety147 = fblinearindextoy147 * fbrowsoffset147;
  143. // UV Offset
  144. float2 fboffset147 = float2(fboffsetx147, fboffsety147);
  145. // Flipbook UV
  146. half2 fbuv147 = uv0123 * fbtiling147 + fboffset147;
  147. // *** END Flipbook UV Animation vars ***
  148. float2 appendResult114 = (float2(_SpeedTex1.x , _SpeedTex1.y));
  149. float2 uv0113 = i.texcoord.xy * float2( 1,1 ) + float2( 0,0 );
  150. float2 panner117 = ( 1.0 * _Time.y * appendResult114 + uv0113);
  151. float4 tex2DNode120 = tex2D( _Tex1, panner117 );
  152. float2 appendResult112 = (float2(_SpeedTex1.z , _SpeedTex1.w));
  153. float2 panner116 = ( 1.0 * _Time.y * appendResult112 + uv0113);
  154. float4 tex2DNode121 = tex2D( _Tex1, ( panner116 * _Wave ) );
  155. float4 tex2DNode127 = tex2D( _Flipbook, ( float4( fbuv147, 0.0 , 0.0 ) + ( ( tex2DNode120.a * tex2DNode121.a * tex2DNode121 * tex2DNode120 ) * _Distortion ) ).rg );
  156. float4 temp_output_143_0 = ( i.color * tex2DNode127 * _EmissionKek * i.color.a );
  157. float4 appendResult169 = (float4(temp_output_143_0.rgb , ( temp_output_143_0 * ( i.color.a * ( tex2DNode127.a * _Add_Blend ) ) ).r));
  158. fixed4 col = saturate( appendResult169 );
  159. UNITY_APPLY_FOG(i.fogCoord, col);
  160. return col;
  161. }
  162. ENDCG
  163. }
  164. }
  165. }
  166. CustomEditor "ASEMaterialInspector"
  167. }
  168. /*ASEBEGIN
  169. Version=18100
  170. 60;84;1920;780;60.93081;-735.1726;1.596035;True;True
  171. Node;AmplifyShaderEditor.Vector4Node;111;-2080.665,1937.716;Float;False;Property;_SpeedTex1;Speed Tex1;3;0;Create;True;0;0;False;0;False;0.21,0.12,-0.06,-0.36;0.21,0,0,0;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  172. Node;AmplifyShaderEditor.TextureCoordinatesNode;113;-1764.634,1814.734;Inherit;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
  173. Node;AmplifyShaderEditor.DynamicAppendNode;112;-1685.384,2051.633;Inherit;False;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0
  174. Node;AmplifyShaderEditor.PannerNode;116;-1509.447,1984.139;Inherit;False;3;0;FLOAT2;0,0;False;2;FLOAT2;0,0;False;1;FLOAT;1;False;1;FLOAT2;0
  175. Node;AmplifyShaderEditor.DynamicAppendNode;114;-1687.172,1929.026;Inherit;False;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0
  176. Node;AmplifyShaderEditor.RangedFloatNode;115;-1438.879,2125.844;Inherit;False;Property;_Wave;Wave;6;0;Create;True;0;0;False;0;False;1.53;0;0;0;0;1;FLOAT;0
  177. Node;AmplifyShaderEditor.PannerNode;117;-1517.057,1848.452;Inherit;False;3;0;FLOAT2;0,0;False;2;FLOAT2;0,0;False;1;FLOAT;1;False;1;FLOAT2;0
  178. Node;AmplifyShaderEditor.TexturePropertyNode;118;-1606.005,1587.677;Float;True;Property;_Tex1;Tex1;1;0;Create;True;0;0;False;0;False;None;4e3951c538fc8a647a4a10a99b480987;False;white;Auto;Texture2D;-1;0;1;SAMPLER2D;0
  179. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;119;-1284.879,2052.843;Inherit;False;2;2;0;FLOAT2;0,0;False;1;FLOAT;0;False;1;FLOAT2;0
  180. Node;AmplifyShaderEditor.SamplerNode;121;-1197.502,1882.3;Inherit;True;Property;_TextureSample0;Texture Sample 0;2;0;Create;True;0;0;False;0;False;-1;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  181. Node;AmplifyShaderEditor.SamplerNode;120;-1156.58,1654.856;Inherit;True;Property;_Noise18;Noise18;0;0;Create;True;0;0;False;0;False;-1;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  182. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;122;-765.4503,1693.714;Inherit;False;4;4;0;FLOAT;0;False;1;FLOAT;0;False;2;COLOR;0,0,0,0;False;3;COLOR;0,0,0,0;False;1;COLOR;0
  183. Node;AmplifyShaderEditor.RangedFloatNode;149;-1214.612,1436.4;Inherit;False;Property;_Rows;Rows;8;0;Create;True;0;0;False;0;False;0;1;0;0;0;1;FLOAT;0
  184. Node;AmplifyShaderEditor.RangedFloatNode;148;-1213.092,1335.607;Inherit;False;Property;_Colums;Colums;7;0;Create;True;0;0;False;0;False;0;1;0;0;0;1;FLOAT;0
  185. Node;AmplifyShaderEditor.RangedFloatNode;126;-697.2817,2069.157;Inherit;False;Property;_Distortion;Distortion;5;0;Create;True;0;0;False;0;False;-0.13;0;0;0;0;1;FLOAT;0
  186. Node;AmplifyShaderEditor.RangedFloatNode;151;-987.6121,1586.4;Inherit;False;Property;_StartFrame;StartFrame;9;0;Create;True;0;0;False;0;False;0;0;0;0;0;1;FLOAT;0
  187. Node;AmplifyShaderEditor.TextureCoordinatesNode;123;-1267.856,1128.097;Inherit;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
  188. Node;AmplifyShaderEditor.RangedFloatNode;152;-796.6121,1582.4;Inherit;False;Property;_Time1;Time1;10;0;Create;True;0;0;False;0;False;0;0;0;0;0;1;FLOAT;0
  189. Node;AmplifyShaderEditor.RangedFloatNode;150;-1129.612,1520.4;Inherit;False;Property;_Speed;Speed;11;0;Create;True;0;0;False;0;False;0;0;0;0;0;1;FLOAT;0
  190. Node;AmplifyShaderEditor.TFHCFlipBookUVAnimation;147;-831.3478,1311.375;Inherit;False;0;0;6;0;FLOAT2;0,0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;4;FLOAT;0;False;5;FLOAT;0;False;3;FLOAT2;0;FLOAT;1;FLOAT;2
  191. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;124;-295.4736,1978.73;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0
  192. Node;AmplifyShaderEditor.SimpleAddOpNode;125;-480.4841,1462.776;Inherit;False;2;2;0;FLOAT2;0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0
  193. Node;AmplifyShaderEditor.SamplerNode;127;-85.37042,1441.391;Inherit;True;Property;_Flipbook;Flipbook;0;0;Create;True;0;0;False;0;False;-1;None;0994522556391e44fbb16fd985f5c474;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  194. Node;AmplifyShaderEditor.RangedFloatNode;139;74.90289,1814.865;Inherit;False;Property;_Add_Blend;Add_Blend;2;0;Create;True;0;0;False;0;False;0;3;0;4;0;1;FLOAT;0
  195. Node;AmplifyShaderEditor.RangedFloatNode;157;128,1088;Inherit;False;Property;_EmissionKek;EmissionKek;12;0;Create;True;0;0;False;0;False;0;1;0;0;0;1;FLOAT;0
  196. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;142;443.8858,1703.367;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
  197. Node;AmplifyShaderEditor.VertexColorNode;145;61.2211,1227.149;Inherit;False;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  198. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;144;611.0779,1501.595;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
  199. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;143;676.0965,1178.501;Inherit;False;4;4;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;COLOR;0
  200. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;170;825.7682,1479.025;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0
  201. Node;AmplifyShaderEditor.DynamicAppendNode;169;1039.31,1362.614;Inherit;False;FLOAT4;4;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT4;0
  202. Node;AmplifyShaderEditor.ColorNode;141;-296.8367,1006.397;Inherit;False;Property;_Color0;Color 0;4;0;Create;True;0;0;False;0;False;0.4339623,0.4073514,0.4073514,1;0.5566038,0.5566038,0.5566038,0.4980392;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  203. Node;AmplifyShaderEditor.SaturateNode;171;1121.218,1553.17;Inherit;False;1;0;FLOAT4;0,0,0,0;False;1;FLOAT4;0
  204. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;166;1400.179,1343.508;Float;False;True;-1;2;ASEMaterialInspector;0;7;GD/Particles/UniversalPremultiplitedFlipbookDistortion;0b6a9f8b4f707c74ca64c0be8e590de0;True;SubShader 0 Pass 0;0;0;SubShader 0 Pass 0;2;True;3;1;False;-1;10;False;-1;0;1;False;-1;0;False;-1;False;False;True;2;False;-1;True;True;True;True;False;0;False;-1;False;True;2;False;-1;True;3;False;-1;False;True;4;Queue=Transparent=Queue=0;IgnoreProjector=True;RenderType=Transparent=RenderType;PreviewType=Plane;False;0;False;False;False;False;False;False;False;False;False;False;True;0;0;;0;0;Standard;0;0;1;True;False;;0
  205. WireConnection;112;0;111;3
  206. WireConnection;112;1;111;4
  207. WireConnection;116;0;113;0
  208. WireConnection;116;2;112;0
  209. WireConnection;114;0;111;1
  210. WireConnection;114;1;111;2
  211. WireConnection;117;0;113;0
  212. WireConnection;117;2;114;0
  213. WireConnection;119;0;116;0
  214. WireConnection;119;1;115;0
  215. WireConnection;121;0;118;0
  216. WireConnection;121;1;119;0
  217. WireConnection;120;0;118;0
  218. WireConnection;120;1;117;0
  219. WireConnection;122;0;120;4
  220. WireConnection;122;1;121;4
  221. WireConnection;122;2;121;0
  222. WireConnection;122;3;120;0
  223. WireConnection;147;0;123;0
  224. WireConnection;147;1;148;0
  225. WireConnection;147;2;149;0
  226. WireConnection;147;3;150;0
  227. WireConnection;147;4;151;0
  228. WireConnection;147;5;152;0
  229. WireConnection;124;0;122;0
  230. WireConnection;124;1;126;0
  231. WireConnection;125;0;147;0
  232. WireConnection;125;1;124;0
  233. WireConnection;127;1;125;0
  234. WireConnection;142;0;127;4
  235. WireConnection;142;1;139;0
  236. WireConnection;144;0;145;4
  237. WireConnection;144;1;142;0
  238. WireConnection;143;0;145;0
  239. WireConnection;143;1;127;0
  240. WireConnection;143;2;157;0
  241. WireConnection;143;3;145;4
  242. WireConnection;170;0;143;0
  243. WireConnection;170;1;144;0
  244. WireConnection;169;0;143;0
  245. WireConnection;169;3;170;0
  246. WireConnection;171;0;169;0
  247. WireConnection;166;0;171;0
  248. ASEEND*/
  249. //CHKSM=1011EDB4EC6E1ECB58DAA9BDE821AAD3034CEAE3