// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'

// Shader created with Shader Forge v1.27 
// Shader Forge (c) Neat Corporation / Joachim Holmer - http://www.acegikmo.com/shaderforge/
// Optimized by Blastom
Shader "Zhanyou/Particles/NiuquAlphaMask" {
    Properties {
        _dif ("dif", 2D) = "white" {}
        [HDR]_node_1068 ("node_1068", Color) = (0.5,0.5,0.5,1)
        _wenli ("wenli", 2D) = "white" {}
		_alpha ("alpha", 2D) = "white" {}
        _niuqu_qiangdu ("niuqu_qiangdu", Range(0, 1)) = 0
		_uvSpeed("UvSpeed (xy for node_3491, zw for node_3745)", Vector) = (0, 0.5, 0, 0)
    }
    SubShader {
        Tags {
            "IgnoreProjector"="True"
            "Queue"="Transparent"
            "RenderType"="Transparent"
        }
		Lighting Off
        Pass {
			//BlendOp Add, Max
            Blend SrcAlpha OneMinusSrcAlpha//, One One
            Cull Off
            ZWrite Off
			ColorMask RGB

            CGPROGRAM
			#include "UnityCG.cginc"
            #pragma vertex vert
            #pragma fragment frag
			#pragma multi_compile_fog
			#pragma multi_compile_particles
            uniform float4 _TimeEditor;
            uniform sampler2D _dif;
			uniform float4 _dif_ST;
            uniform float4 _node_1068;
            uniform sampler2D _wenli;
			uniform float4 _wenli_ST;
            uniform float _niuqu_qiangdu;
			uniform half4 _uvSpeed;
			uniform sampler2D _alpha;
			uniform float4 _alpha_ST;
            struct VertexInput {
                float4 vertex : POSITION;
                float2 texcoord0 : TEXCOORD0;
                float4 vertexColor : COLOR;
            };
            struct VertexOutput {
                float4 pos : SV_POSITION;
                float2 uv0 : TEXCOORD0;
				UNITY_FOG_COORDS(1)
                float4 vertexColor : COLOR;
            };
            VertexOutput vert (VertexInput v) {
				VertexOutput o;
				UNITY_INITIALIZE_OUTPUT(VertexOutput, o);
                o.uv0 = v.texcoord0;
                o.vertexColor = v.vertexColor;
                o.pos = UnityObjectToClipPos(v.vertex);
				UNITY_TRANSFER_FOG(o,o.pos); 
                return o;
            }
            float4 frag(VertexOutput i) : SV_TARGET {
                float4 node_3639 = _Time + _TimeEditor;
				float2 node_3491 = TRANSFORM_TEX(i.uv0, _wenli);
                float4 _wenli_var = tex2D(_wenli, node_3491 + node_3639.g * _uvSpeed.xy);
				float2 node_3745 = TRANSFORM_TEX((i.uv0 + _wenli_var.rg * _niuqu_qiangdu), _dif);
                float4 _dif_var = tex2D(_dif, node_3745 + node_3639.g * _uvSpeed.zw);
                float3 emissive = _dif_var.rgb * _node_1068.rgb * 3.0 * i.vertexColor.rgb;
				fixed4 c = fixed4(emissive, _dif_var.a * i.vertexColor.a * _node_1068.a) * 2.0;
                float4 _alpha_var = tex2D(_alpha, TRANSFORM_TEX(i.uv0, _alpha));
				c.a *= _alpha_var.a;
				UNITY_APPLY_FOG(i.fogCoord, c);
                return c;
            }
            ENDCG
        }
    }
	// SM3.0���»������������ݻ��ӻع�������ȾShader
	SubShader
	{
		Tags {
	        "IgnoreProjector"="True"
	        "Queue"="Transparent"
			// ��ֹShader Replace��Ⱦ�������
	        "RenderType"="NoReplace"
		}
		Pass {
			ColorMask 0
		}
	}
}