// Made with Amplify Shader Editor
// Available at the Unity Asset Store - http://u3d.as/y3X 
Shader "URP/Effects/Particle/Blast-3T-3C-Soft"
{
	Properties
	{
		[HDR]_SmokeColor("SmokeColor", Color) = (0.3183391,0.3949051,0.6764706,0)
		[HDR]_AbroadColor("AbroadColor", Color) = (2,0.6916838,0.1029413,1)
		[HDR]_WithinColor("WithinColor", Color) = (1.5,1.060289,0.6507353,1)
		_FireMap("FireMap", 2D) = "white" {}
		_UVFlowSpeed("UVFlowSpeed", Vector) = (0,-0.3,0,0)
		_UVTiling("UV-Tiling", Range( 0 , 4)) = 0
		_SmokeTexture("SmokeTexture", 2D) = "white" {}
		_DissloveMap("DissloveMap", 2D) = "white" {}
		_FireEdge("FireEdge", Range( 1 , 1.5)) = 0.468391
		_FireOffsetInstensity("Fire-Offset-Instensity", Range( 0 , 6)) = 0.468391
		[Toggle]_FireOffset("Fire-Offset", Float) = 0
		[HideInInspector] _tex4coord( "", 2D ) = "white" {}
		[HideInInspector] _texcoord( "", 2D ) = "white" {}
		[HideInInspector] __dirty( "", Int ) = 1
	}

	SubShader
	{
		Tags{ "RenderType" = "Transparent"  "Queue" = "Transparent+0" "IgnoreProjector" = "True" "IsEmissive" = "true"  }
		Pass {
		Cull Off
		ZWrite Off
		Blend SrcAlpha OneMinusSrcAlpha
		
		CGPROGRAM
		#include "UnityShaderVariables.cginc"
		#include "Tessellation.cginc"
		#pragma vertex vert
		#pragma fragment frag
		#pragma target 3.0
		#pragma only_renderers d3d9 d3d11 glcore gles gles3 metal 
		#undef TRANSFORM_TEX
		#define TRANSFORM_TEX(tex,name) float4(tex.xy * name##_ST.xy + name##_ST.zw, tex.z, tex.w)
		uniform float _FireOffsetInstensity;
		uniform float _FireOffset;
		uniform sampler2D _SmokeTexture;
		uniform float _UVTiling;
		uniform float2 _UVFlowSpeed;
		uniform sampler2D _FireMap;
		uniform float4 _WithinColor;
		uniform float4 _AbroadColor;
		uniform float _FireEdge;
		uniform float4 _SmokeColor;
		uniform sampler2D _DissloveMap;
		uniform float4 _DissloveMap_ST;
		uniform float _EdgeLength;

		struct VertexInput {
			float4 vertex : POSITION;
			float3 normal : NORMAL;
			float4 uv_tex4coord : TEXCOORD0;
			float4 texcoord : TEXCOORD1;
			float4 vertexColor : COLOR;
		};
		struct VertexOutput {
			float4 vertex : SV_POSITION;
			float4 vertexColor : COLOR;
			float2 uv_texcoord : TEXCOORD0;
			float4 uv_tex4coord : TEXCOORD1;
		};
		VertexOutput vert (VertexInput v) {
			VertexOutput o;
			o.vertexColor = v.vertexColor;
			o.uv_texcoord = v.texcoord.xy;
			o.uv_tex4coord = v.uv_tex4coord;
			o.vertex = UnityObjectToClipPos(v.vertex);
			float3 ase_vertexNormal = v.normal.xyz;
			float2 temp_cast_1 = (_UVTiling).xx;
			float mulTime28 = _Time.y * 0.4;
			float2 panner27 = ( mulTime28 * ( _UVFlowSpeed * 3.0 ) + float2( 0,0 ));
			float2 uv_TexCoord25 = v.texcoord.xy * temp_cast_1 + panner27;
			float4 tex2DNode8 = tex2Dlod( _SmokeTexture, float4( uv_TexCoord25, 0, 0.0) );
			float4 temp_cast_2 = (v.texcoord.z).xxxx;
			float4 tex2DNode44 = tex2Dlod( _FireMap, float4( uv_TexCoord25, 0, 0.0) );
			float4 temp_output_52_0 = step( temp_cast_2 , tex2DNode44 );
			o.vertex.xyz += ( float4( ase_vertexNormal , 0.0 ) * _FireOffsetInstensity * lerp(( tex2DNode8 * 1.0 ),temp_output_52_0,_FireOffset) ).rgb;
			return o;
		}
		float4 frag(VertexOutput i) : SV_Target 
		{
			i.uv_tex4coord.zw = half2(0,0);
			float4 temp_cast_0 = (i.uv_tex4coord.z).xxxx;
			float2 temp_cast_1 = (_UVTiling).xx;
			float mulTime28 = _Time.y * 0.4;
			float2 panner27 = ( mulTime28 * ( _UVFlowSpeed * 3.0 ) + float2( 0,0 ));
			float2 uv_TexCoord25 = i.uv_texcoord * temp_cast_1 + panner27;
			float4 tex2DNode44 = tex2D( _FireMap, uv_TexCoord25 );
			float4 lerpResult49 = lerp( _WithinColor , _AbroadColor , step( temp_cast_0 , ( tex2DNode44 * _FireEdge ) ));
			float4 tex2DNode8 = tex2D( _SmokeTexture, uv_TexCoord25 );
			float4 temp_output_52_0 = step( temp_cast_0 , tex2DNode44 );
			float4 lerpResult48 = lerp( lerpResult49 , ( tex2DNode8 * _SmokeColor ) , temp_output_52_0);
			half4 col;
			col.rgb = ( lerpResult48 * i.vertexColor ).rgb;
			float2 uv_DissloveMap = i.uv_texcoord * _DissloveMap_ST.xy + _DissloveMap_ST.zw;
			float4 temp_cast_4 = (( 1.0 - abs( i.uv_tex4coord.w ) )).xxxx;
			float4 temp_cast_5 = (5.0).xxxx;
			col.a = ( saturate( pow( ((saturate( ( tex2D( _DissloveMap, uv_DissloveMap ) + i.uv_tex4coord.w ) )) * float4( 1,1,1,0 ) / temp_cast_4) , temp_cast_5*(1-i.vertexColor.a) ) ) ).r;
			return col;
		}
		ENDCG
		}
	}
	//CustomEditor "ASEMaterialInspector"
}