Files
JJBB/Assets/Project/Shader/ParticleNiuqu.shader
2024-08-23 15:49:34 +08:00

108 lines
3.9 KiB
Plaintext

// 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/Niuqu" {
Properties {
_dif ("dif", 2D) = "white" {}
_niuqu_qiangdu ("niuqu_qiangdu", Range(0, 3)) = 0
_wenli ("wenli", 2D) = "white" {}
_wenli_qiangdu ("wenli_qiangdu", Range(0, 3)) = 0
_alpha ("alpha", 2D) = "white" {}
_uvSpeed ("UvSpeed (xy for node_4447, zw for node_6494)", Vector) = (0.2, 0.2, 0, 0)
}
SubShader {
Tags {
"IgnoreProjector"="True"
"Queue"="AlphaTest+60"
// 防止Shader Replace渲染这个东西
"RenderType"="NoReplace"
}
GrabPass{"_DistortionTex"}
Lighting Off
LOD 600
Pass {
Name "FORWARD"
Tags {
"LightMode"="ForwardBase"
}
//Blend SrcAlpha OneMinusSrcAlpha
Cull Off
ZWrite Off
CGPROGRAM
#include "UnityCG.cginc"
#pragma vertex vert
#pragma fragment frag
#pragma target 3.0
uniform sampler2D _DistortionTex;
//uniform sampler2D _GrabTexture;
uniform float4 _TimeEditor;
uniform sampler2D _dif;
uniform float4 _dif_ST;
uniform float _niuqu_qiangdu;
uniform sampler2D _wenli;
uniform float4 _wenli_ST;
uniform float _wenli_qiangdu;
uniform sampler2D _alpha;
uniform float4 _alpha_ST;
uniform half4 _uvSpeed;
struct VertexInput {
float4 vertex : POSITION;
float2 texcoord0 : TEXCOORD0;
float4 vertexColor : COLOR;
};
struct VertexOutput {
float4 pos : SV_POSITION;
float2 uv0 : TEXCOORD0;
float4 screenPos : TEXCOORD1;
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);
o.screenPos = o.pos;
return o;
}
float4 frag(VertexOutput i) : SV_TARGET {
#if UNITY_UV_STARTS_AT_TOP
float grabSign = -_ProjectionParams.x;
#else
float grabSign = _ProjectionParams.x;
#endif
i.screenPos = float4( i.screenPos.xy / i.screenPos.w, 0, 0 );
i.screenPos.y *= _ProjectionParams.x;
float4 node_3916 = _Time + _TimeEditor;
float2 node_4447 = i.uv0 + node_3916.g * _uvSpeed.xy;
float4 _wenli_var = tex2D(_wenli, TRANSFORM_TEX(node_4447, _wenli));
float2 node_6494 = _wenli_var.b * _wenli_qiangdu + i.uv0 + node_3916.g * _uvSpeed.zw;
float4 _dif_var = tex2D(_dif, TRANSFORM_TEX(node_6494, _dif));
float4 _alpha_var = tex2D(_alpha, TRANSFORM_TEX(i.uv0, _alpha));
float2 sceneUVs = float2(1, grabSign) * i.screenPos.xy * 0.5 + 0.5 + float2(_dif_var.r, _dif_var.g) * _dif_var.a * _niuqu_qiangdu * i.vertexColor.a * _alpha_var.a;
//float4 sceneColor = tex2D(_GrabTexture, sceneUVs);
float4 sceneColor = tex2D(_DistortionTex, sceneUVs);
fixed4 c = fixed4(sceneColor.rgb, 1);
return c;
}
ENDCG
}
}
// SM3.0以下或者其他不兼容机子回滚到不渲染Shader
SubShader
{
Tags {
"IgnoreProjector"="True"
"Queue"="AlphaTest+60"
// 防止Shader Replace渲染这个东西
"RenderType"="NoReplace"
}
Pass {
ColorMask 0
ZWrite Off
}
}
}