86 lines
2.0 KiB
Plaintext
86 lines
2.0 KiB
Plaintext
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
|
|
|
Shader "Xffect/distort_additive" {
|
|
Properties {
|
|
_TintColor ("Tint Color", Color) = (0.5,0.5,0.5,0.5)
|
|
_NoiseTex ("Distort Texture (RG)", 2D) = "white" {}
|
|
_MainTex ("Alpha (A)", 2D) = "white" {}
|
|
_HeatTime ("Heat Time",Float) = 0.5
|
|
_ForceX ("Strength X", Float) = 0.4
|
|
_ForceY ("Strength Y", Float) = 0.4
|
|
}
|
|
|
|
Category {
|
|
Tags { "Queue"="Transparent" "RenderType"="Transparent" }
|
|
Blend SrcAlpha One
|
|
Cull Off Lighting Off ZWrite Off Fog { Color (0,0,0,0) }
|
|
BindChannels {
|
|
Bind "Color", color
|
|
Bind "Vertex", vertex
|
|
Bind "TexCoord", texcoord
|
|
}
|
|
|
|
SubShader {
|
|
Pass {
|
|
CGPROGRAM
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
#pragma fragmentoption ARB_precision_hint_fastest
|
|
#pragma multi_compile_particles
|
|
#include "UnityCG.cginc"
|
|
|
|
struct appdata_t {
|
|
float4 vertex : POSITION;
|
|
fixed4 color : COLOR;
|
|
float2 texcoord: TEXCOORD0;
|
|
};
|
|
|
|
struct v2f {
|
|
float4 vertex : POSITION;
|
|
fixed4 color : COLOR;
|
|
float2 uvmain : TEXCOORD1;
|
|
};
|
|
|
|
fixed4 _TintColor;
|
|
fixed _ForceX;
|
|
fixed _ForceY;
|
|
fixed _HeatTime;
|
|
float4 _MainTex_ST;
|
|
float4 _NoiseTex_ST;
|
|
sampler2D _NoiseTex;
|
|
sampler2D _MainTex;
|
|
|
|
v2f vert (appdata_t v)
|
|
{
|
|
v2f o;
|
|
o.vertex = UnityObjectToClipPos(v.vertex);
|
|
o.color = v.color;
|
|
o.uvmain = TRANSFORM_TEX( v.texcoord, _MainTex );
|
|
return o;
|
|
}
|
|
|
|
fixed4 frag( v2f i ) : COLOR
|
|
{
|
|
//noise effect
|
|
fixed4 offsetColor1 = tex2D(_NoiseTex, i.uvmain + _Time.xz*_HeatTime);
|
|
fixed4 offsetColor2 = tex2D(_NoiseTex, i.uvmain + _Time.yx*_HeatTime);
|
|
i.uvmain.x += ((offsetColor1.r + offsetColor2.r) - 1) * _ForceX;
|
|
i.uvmain.y += ((offsetColor1.r + offsetColor2.r) - 1) * _ForceY;
|
|
return 2.0f * i.color * _TintColor * tex2D( _MainTex, i.uvmain);
|
|
}
|
|
ENDCG
|
|
}
|
|
}
|
|
// ------------------------------------------------------------------
|
|
// Fallback for older cards and Unity non-Pro
|
|
|
|
SubShader {
|
|
Blend DstColor Zero
|
|
Pass {
|
|
Name "BASE"
|
|
SetTexture [_MainTex] { combine texture }
|
|
}
|
|
}
|
|
}
|
|
}
|