// Made with Amplify Shader Editor v1.9.6.3
// Available at the Unity Asset Store - http://u3d.as/y3X 
Shader "Flame"
{
	Properties
	{
		_Flipbook("Flipbook", 2D) = "white" {}
		_Intro("Intro", 2D) = "white" {}
		_Transition("Transition", Range( 0 , 1)) = 0
		_IntroFrame("IntroFrame", Range( 0 , 1.45)) = 0
		[HideInInspector] _texcoord( "", 2D ) = "white" {}
		[HideInInspector] __dirty( "", Int ) = 1
	}

	SubShader
	{
		Tags{ "RenderType" = "Transparent"  "Queue" = "Transparent+0" "IgnoreProjector" = "True" "IsEmissive" = "true"  }
		Cull Off
		ZWrite Off
		Blend SrcAlpha One
		
		CGPROGRAM
		#include "UnityShaderVariables.cginc"
		#pragma target 3.0
		#pragma surface surf Unlit keepalpha noshadow 
		struct Input
		{
			float2 uv_texcoord;
		};

		uniform sampler2D _Intro;
		uniform float _IntroFrame;
		uniform sampler2D _Flipbook;
		uniform float _Transition;

		inline half4 LightingUnlit( SurfaceOutput s, half3 lightDir, half atten )
		{
			return half4 ( 0, 0, 0, s.Alpha );
		}

		void surf( Input i , inout SurfaceOutput o )
		{
			float temp_output_4_0_g2 = 5.0;
			float temp_output_5_0_g2 = 18.0;
			// *** BEGIN Flipbook UV Animation vars ***
			// Total tiles of Flipbook Texture
			float fbtotaltiles246_g2 = min( temp_output_4_0_g2 * temp_output_5_0_g2, ( ( temp_output_4_0_g2 * temp_output_5_0_g2 ) - 0.0 ) + 1 );
			// Offsets for cols and rows of Flipbook Texture
			float fbcolsoffset246_g2 = 1.0f / temp_output_4_0_g2;
			float fbrowsoffset246_g2 = 1.0f / temp_output_5_0_g2;
			// Speed of animation
			float fbspeed246_g2 = _IntroFrame * 60.0;
			// UV Tiling (col and row offset)
			float2 fbtiling246_g2 = float2(fbcolsoffset246_g2, fbrowsoffset246_g2);
			// UV Offset - calculate current tile linear index, and convert it to (X * coloffset, Y * rowoffset)
			// Calculate current tile linear index
			float fbcurrenttileindex246_g2 = floor( fmod( fbspeed246_g2 + 0.0, fbtotaltiles246_g2) );
			fbcurrenttileindex246_g2 += ( fbcurrenttileindex246_g2 < 0) ? fbtotaltiles246_g2 : 0;
			// Obtain Offset X coordinate from current tile linear index
			float fblinearindextox246_g2 = round ( fmod ( fbcurrenttileindex246_g2, temp_output_4_0_g2 ) );
			// Multiply Offset X by coloffset
			float fboffsetx246_g2 = fblinearindextox246_g2 * fbcolsoffset246_g2;
			// Obtain Offset Y coordinate from current tile linear index
			float fblinearindextoy246_g2 = round( fmod( ( fbcurrenttileindex246_g2 - fblinearindextox246_g2 ) / temp_output_4_0_g2, temp_output_5_0_g2 ) );
			// Reverse Y to get tiles from Top to Bottom
			fblinearindextoy246_g2 = (int)(temp_output_5_0_g2-1) - fblinearindextoy246_g2;
			// Multiply Offset Y by rowoffset
			float fboffsety246_g2 = fblinearindextoy246_g2 * fbrowsoffset246_g2;
			// UV Offset
			float2 fboffset246_g2 = float2(fboffsetx246_g2, fboffsety246_g2);
			// Flipbook UV
			half2 fbuv246_g2 = i.uv_texcoord * fbtiling246_g2 + fboffset246_g2;
			// *** END Flipbook UV Animation vars ***
			int flipbookFrame246_g2 = ( ( int )fbcurrenttileindex246_g2);
			float temp_output_4_0_g1 = 5.0;
			float temp_output_5_0_g1 = 18.0;
			float fbtotaltiles246_g1 = min( temp_output_4_0_g1 * temp_output_5_0_g1, ( ( temp_output_4_0_g1 * temp_output_5_0_g1 ) - 0.0 ) + 1 );
			float fbcolsoffset246_g1 = 1.0f / temp_output_4_0_g1;
			float fbrowsoffset246_g1 = 1.0f / temp_output_5_0_g1;
			float fbspeed246_g1 = _Time.y * 60.0;
			float2 fbtiling246_g1 = float2(fbcolsoffset246_g1, fbrowsoffset246_g1);
			float fbcurrenttileindex246_g1 = floor( fmod( fbspeed246_g1 + 0.0, fbtotaltiles246_g1) );
			fbcurrenttileindex246_g1 += ( fbcurrenttileindex246_g1 < 0) ? fbtotaltiles246_g1 : 0;
			float fblinearindextox246_g1 = round ( fmod ( fbcurrenttileindex246_g1, temp_output_4_0_g1 ) );
			float fboffsetx246_g1 = fblinearindextox246_g1 * fbcolsoffset246_g1;
			float fblinearindextoy246_g1 = round( fmod( ( fbcurrenttileindex246_g1 - fblinearindextox246_g1 ) / temp_output_4_0_g1, temp_output_5_0_g1 ) );
			fblinearindextoy246_g1 = (int)(temp_output_5_0_g1-1) - fblinearindextoy246_g1;
			float fboffsety246_g1 = fblinearindextoy246_g1 * fbrowsoffset246_g1;
			float2 fboffset246_g1 = float2(fboffsetx246_g1, fboffsety246_g1);
			half2 fbuv246_g1 = i.uv_texcoord * fbtiling246_g1 + fboffset246_g1;
			int flipbookFrame246_g1 = ( ( int )fbcurrenttileindex246_g1);
			float3 lerpResult6 = lerp( tex2D( _Intro, fbuv246_g2 ).rgb , tex2D( _Flipbook, fbuv246_g1 ).rgb , _Transition);
			o.Emission = lerpResult6;
			o.Alpha = 1;
		}

		ENDCG
	}
	CustomEditor "ASEMaterialInspector"
}
/*ASEBEGIN
Version=19603
Node;AmplifyShaderEditor.TexturePropertyNode;2;-976,0;Inherit;True;Property;_Flipbook;Flipbook;1;0;Create;True;0;0;0;False;0;False;None;None;False;white;Auto;Texture2D;-1;0;2;SAMPLER2D;0;SAMPLERSTATE;1
Node;AmplifyShaderEditor.RangedFloatNode;11;-1008,752;Inherit;False;Property;_IntroFrame;IntroFrame;4;0;Create;True;0;0;0;False;0;False;0;0;0;1.45;0;1;FLOAT;0
Node;AmplifyShaderEditor.TexturePropertyNode;7;-688,368;Inherit;True;Property;_Intro;Intro;2;0;Create;True;0;0;0;False;0;False;None;None;False;white;Auto;Texture2D;-1;0;2;SAMPLER2D;0;SAMPLERSTATE;1
Node;AmplifyShaderEditor.FunctionNode;4;-704,96;Inherit;False;Flipbook;-1;;1;53c2488c220f6564ca6c90721ee16673;3,68,0,217,0,244,0;11;51;SAMPLER2D;0.0;False;167;SAMPLERSTATE;0;False;13;FLOAT2;0,0;False;24;FLOAT;0;False;210;FLOAT;4;False;4;FLOAT;5;False;5;FLOAT;18;False;130;FLOAT;60;False;2;FLOAT;0;False;55;FLOAT;0;False;70;FLOAT;0;False;5;COLOR;53;FLOAT2;0;FLOAT;47;FLOAT;48;INT;218
Node;AmplifyShaderEditor.FunctionNode;9;-688,576;Inherit;False;Flipbook;-1;;2;53c2488c220f6564ca6c90721ee16673;3,68,0,217,0,244,1;11;51;SAMPLER2D;0.0;False;167;SAMPLERSTATE;0;False;13;FLOAT2;0,0;False;24;FLOAT;0;False;210;FLOAT;4;False;4;FLOAT;5;False;5;FLOAT;18;False;130;FLOAT;60;False;2;FLOAT;0;False;55;FLOAT;0;False;70;FLOAT;0;False;5;COLOR;53;FLOAT2;0;FLOAT;47;FLOAT;48;INT;218
Node;AmplifyShaderEditor.SamplerNode;1;-368,0;Inherit;True;Property;_TextureSample0;Texture Sample 0;0;0;Create;True;0;0;0;False;0;False;-1;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;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;6;FLOAT;0;False;7;SAMPLERSTATE;;False;6;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT3;5
Node;AmplifyShaderEditor.SamplerNode;8;-320,368;Inherit;True;Property;_TextureSample1;Texture Sample 0;0;0;Create;True;0;0;0;False;0;False;-1;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;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;6;FLOAT;0;False;7;SAMPLERSTATE;;False;6;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT3;5
Node;AmplifyShaderEditor.RangedFloatNode;10;-336,240;Inherit;False;Property;_Transition;Transition;3;0;Create;True;0;0;0;False;0;False;0;0;0;1;0;1;FLOAT;0
Node;AmplifyShaderEditor.SimpleTimeNode;5;-912,208;Inherit;False;1;0;FLOAT;1;False;1;FLOAT;0
Node;AmplifyShaderEditor.LerpOp;6;-16,160;Inherit;False;3;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT;0;False;1;FLOAT3;0
Node;AmplifyShaderEditor.StandardSurfaceOutputNode;0;176,-16;Float;False;True;-1;2;ASEMaterialInspector;0;0;Unlit;Flame;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;False;False;False;False;False;False;Off;2;False;;0;False;;False;0;False;;0;False;;False;0;Custom;0.5;True;False;0;True;Transparent;;Transparent;All;12;all;True;True;True;True;0;False;;False;0;False;;255;False;;255;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;2;15;10;25;False;0.5;False;8;5;False;;1;False;;0;1;False;;10;False;;0;False;;0;False;;0;False;0;0,0,0,0;VertexOffset;True;False;Cylindrical;False;True;Relative;0;;0;-1;-1;-1;0;False;0;0;False;;-1;0;False;;0;0;0;False;0.1;False;;0;False;;False;16;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;3;FLOAT;0;False;4;FLOAT;0;False;6;FLOAT3;0,0,0;False;7;FLOAT3;0,0,0;False;8;FLOAT;0;False;9;FLOAT;0;False;10;FLOAT;0;False;13;FLOAT3;0,0,0;False;11;FLOAT3;0,0,0;False;12;FLOAT3;0,0,0;False;16;FLOAT4;0,0,0,0;False;14;FLOAT4;0,0,0,0;False;15;FLOAT3;0,0,0;False;0
WireConnection;4;51;2;0
WireConnection;9;2;11;0
WireConnection;1;0;2;0
WireConnection;1;1;4;0
WireConnection;8;0;7;0
WireConnection;8;1;9;0
WireConnection;6;0;8;5
WireConnection;6;1;1;5
WireConnection;6;2;10;0
WireConnection;0;2;6;0
ASEEND*/
//CHKSM=6B58EA9B9E5AF1A954DFD691F4242B293819EFE3