109 lines
2.7 KiB
Plaintext
109 lines
2.7 KiB
Plaintext
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
|
|
|
Shader "KriptoFX/ME/DistortionSlime" {
|
|
Properties{
|
|
_TintColor("Main Color", Color) = (1,1,1,1)
|
|
_MainTex("Base (RGB) Emission Tex (A)", 2D) = "white" {}
|
|
_CutOut("CutOut (A)", 2D) = "white" {}
|
|
_BumpMap("Normalmap", 2D) = "bump" {}
|
|
_BumpAmt("Distortion", Float) = 10
|
|
}
|
|
Category{
|
|
|
|
Tags { "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" "LightMode" = "CustomDistortion" }
|
|
Blend SrcAlpha OneMinusSrcAlpha
|
|
ZWrite Off
|
|
Offset -1,-1
|
|
Cull Off
|
|
|
|
|
|
SubShader {
|
|
|
|
Pass {
|
|
CGPROGRAM
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
#pragma target 3.0
|
|
|
|
#include "UnityCG.cginc"
|
|
|
|
sampler2D _MainTex;
|
|
sampler2D _BumpMap;
|
|
sampler2D _CutOut;
|
|
samplerCUBE _Cube;
|
|
|
|
float _BumpAmt;
|
|
sampler2D _GrabTexture;
|
|
float4 _GrabTexture_TexelSize;
|
|
|
|
float4 _TintColor;
|
|
float _FPOW;
|
|
float _R0;
|
|
|
|
struct appdata_t {
|
|
float4 vertex : POSITION;
|
|
float3 normal : NORMAL;
|
|
fixed4 color : COLOR;
|
|
float2 texcoord : TEXCOORD0;
|
|
};
|
|
|
|
struct v2f {
|
|
half4 vertex : POSITION;
|
|
half2 uv_MainTex: TEXCOORD0;
|
|
half2 uv_BumpMap : TEXCOORD1;
|
|
half2 uv_CutOut : TEXCOORD2;
|
|
half4 grab : TEXCOORD3;
|
|
fixed4 color : COLOR;
|
|
};
|
|
|
|
float4 _MainTex_ST;
|
|
float4 _BumpMap_ST;
|
|
float4 _CutOut_ST;
|
|
|
|
v2f vert(appdata_full v)
|
|
{
|
|
v2f o;
|
|
|
|
o.uv_MainTex = TRANSFORM_TEX(v.texcoord, _MainTex);
|
|
o.uv_BumpMap = TRANSFORM_TEX(v.texcoord, _BumpMap);
|
|
o.uv_CutOut = TRANSFORM_TEX(v.texcoord, _CutOut);
|
|
|
|
o.vertex = UnityObjectToClipPos(v.vertex);
|
|
#if UNITY_UV_STARTS_AT_TOP
|
|
half scale = -1.0;
|
|
#else
|
|
half scale = 1.0;
|
|
#endif
|
|
o.grab.xy = (half2(o.vertex.x, o.vertex.y*scale) + o.vertex.w) * 0.5;
|
|
o.grab.zw = o.vertex.w;
|
|
#if UNITY_SINGLE_PASS_STEREO
|
|
o.grab.xy = TransformStereoScreenSpaceTex(o.grab.xy, o.grab.w);
|
|
#endif
|
|
|
|
o.color = v.color;
|
|
|
|
return o;
|
|
}
|
|
|
|
fixed4 frag(v2f i) : COLOR
|
|
{
|
|
half4 tex = tex2D(_MainTex, i.uv_MainTex);
|
|
half4 c = tex * _TintColor;
|
|
half4 cut = tex2D(_CutOut, i.uv_CutOut);
|
|
|
|
half3 normal = UnpackNormal(tex2D(_BumpMap, i.uv_BumpMap));
|
|
|
|
half2 offset = normal.rg * _BumpAmt * _GrabTexture_TexelSize.xy * i.color.a;
|
|
i.grab.xy = offset * i.grab.z + i.grab.xy;
|
|
half4 col = tex2Dproj(_GrabTexture, UNITY_PROJ_COORD(i.grab));
|
|
|
|
fixed gray = col.r * 0.3 + col.g * 0.59 + col.b * 0.11;
|
|
half3 emission = col.rgb*_TintColor.rgb;
|
|
|
|
return fixed4(emission, cut.a * _TintColor.a * i.color.r * i.color.a);
|
|
}
|
|
ENDCG
|
|
}
|
|
}
|
|
}
|
|
} |