Shader "Character/Basic"
|
{
|
|
|
Subshader
|
{
|
Tags { "Queue" = "Geometry" "IgnoreProjector" = "True" "LightMode" = "ForwardBase" }
|
|
//渲染X光效果的Pass
|
Pass
|
{
|
|
Name "XRAYPASSBASE"
|
|
Blend SrcAlpha One
|
ZWrite Off
|
ZTest Greater
|
|
CGPROGRAM
|
|
#include "Lighting.cginc"
|
#pragma vertex vert
|
#pragma fragment frag
|
|
struct v2f
|
{
|
float4 pos: SV_POSITION;
|
};
|
|
v2f vert(appdata_base v)
|
{
|
v2f o;
|
o.pos = UnityObjectToClipPos(v.vertex);
|
return o;
|
}
|
|
fixed4 frag(v2f i): SV_Target
|
{
|
return float4(0, 0, 0, 0);
|
}
|
|
ENDCG
|
|
}
|
|
//渲染X光效果的Pass
|
Pass
|
{
|
Name "XRAYPASSHERO"
|
|
Blend SrcAlpha One
|
ZWrite Off
|
ZTest Greater
|
|
CGPROGRAM
|
|
#include "Lighting.cginc"
|
#pragma vertex vert
|
#pragma fragment frag
|
|
fixed4 _XRayColor;
|
|
struct v2f
|
{
|
float4 pos: SV_POSITION;
|
float3 normal: normal;
|
float3 viewDir: TEXCOORD0;
|
};
|
|
v2f vert(appdata_base v)
|
{
|
v2f o;
|
o.pos = UnityObjectToClipPos(v.vertex);
|
o.viewDir = ObjSpaceViewDir(v.vertex);
|
o.normal = v.normal;
|
return o;
|
}
|
|
fixed4 frag(v2f i): SV_Target
|
{
|
half3 normal = normalize(i.normal);
|
half3 viewDir = normalize(i.viewDir);
|
half rim = 1 - dot(normal, viewDir);
|
return float4(_XRayColor.rgb, _XRayColor.a * 3) * rim;
|
}
|
|
ENDCG
|
|
}
|
|
Pass
|
{
|
Name "EMISSION_FLOW_ALPHA"
|
|
Cull Back
|
Fog
|
{
|
Mode Off
|
}
|
|
Blend SrcAlpha OneMinusSrcAlpha
|
CGPROGRAM
|
|
#pragma target 3.0
|
#pragma vertex vert
|
#pragma fragment frag
|
|
#pragma multi_compile_fwdbase
|
#pragma exclude_renderers flash
|
|
#include "UnityCG.cginc"
|
#include "SnxxzCG.cginc"
|
|
struct vertexInput
|
{
|
half4 vertex: POSITION;
|
half3 normal: NORMAL;
|
half4 tangent: TANGENT;
|
half2 texcoord: TEXCOORD0;
|
};
|
|
struct v2f
|
{
|
// basics
|
half4 pos: SV_POSITION;
|
half2 uv1: TEXCOORD0;
|
};
|
// assets
|
uniform sampler2D _MainTex;
|
uniform sampler2D _ChanTex;
|
|
v2f vert(vertexInput v)
|
{
|
v2f o;
|
|
// pos and uv tex coord
|
o.pos = UnityObjectToClipPos(v.vertex);
|
o.uv1 = v.texcoord;
|
return o;
|
}
|
|
fixed4 _FlowColor;
|
fixed _FlowSpeed;
|
fixed _FlowDirectionH;
|
fixed _FlowDirectionV;
|
fixed _FlowIntensity;
|
|
fixed4 _SelfLuminousColor;
|
fixed _SelfLuminousSpeed;
|
fixed _SelfLuminousIntensity;
|
fixed _SelfLuminousMin;
|
fixed _SelfLuminousMax;
|
|
fixed4 frag(v2f i): SV_Target
|
{
|
|
// textures
|
fixed4 outcolor = tex2D(_MainTex, i.uv1);
|
fixed3 channels = tex2D(_ChanTex, i.uv1);
|
|
outcolor.rgb *= 1.2;
|
fixed timeadd = _Time.y * 5 * _FlowSpeed;
|
|
fixed uvshiftH = (timeadd - floor(timeadd)) * _FlowDirectionH;
|
fixed uvshiftV = (timeadd - floor(timeadd)) * _FlowDirectionV;
|
|
fixed channelsB = tex2D(_ChanTex, i.uv1 + fixed2(uvshiftH, uvshiftV)).b;
|
outcolor.rgb += _FlowColor * channels.r * _FlowIntensity * channelsB;
|
|
fixed delta = _SelfLuminousMax - _SelfLuminousMin;
|
outcolor.rgb += _SelfLuminousColor * channels.g * ((delta * 0.5 * sin(_Time.y * 10 * _SelfLuminousSpeed)) + (2 - _SelfLuminousMin) * 0.5) * _SelfLuminousIntensity;
|
|
return outcolor;
|
}
|
|
ENDCG
|
|
}
|
|
Pass
|
{
|
Name "EMISSION_FLOW"
|
|
Cull Back
|
Fog
|
{
|
Mode Off
|
}
|
|
CGPROGRAM
|
|
#pragma target 3.0
|
#pragma vertex vert
|
#pragma fragment frag
|
|
#pragma multi_compile_fwdbase
|
#pragma multi_compile QUALITY_LOW QUALITY_MED QUALITY_HGH
|
|
#pragma exclude_renderers flash
|
|
#include "UnityCG.cginc"
|
#include "SnxxzCG.cginc"
|
|
struct vertexInput
|
{
|
half4 vertex: POSITION;
|
half3 normal: NORMAL;
|
half4 tangent: TANGENT;
|
half2 texcoord: TEXCOORD0;
|
};
|
|
struct v2f
|
{
|
// basics
|
half4 pos: SV_POSITION;
|
half2 uv1: TEXCOORD0;
|
half3 lgt: TEXCOORD5;
|
};
|
// assets
|
uniform sampler2D _MainTex;
|
uniform sampler2D _ChanTex;
|
|
// properties
|
uniform half _Hit;
|
|
v2f vert(vertexInput v)
|
{
|
v2f o;
|
|
// pos and uv tex coord
|
o.pos = UnityObjectToClipPos(v.vertex);
|
o.uv1 = v.texcoord;
|
|
o.lgt = 0.6 + _Hit;
|
return o;
|
}
|
|
fixed4 _FlowColor;
|
fixed _FlowSpeed;
|
fixed _FlowDirectionH;
|
fixed _FlowDirectionV;
|
fixed _FlowIntensity;
|
|
fixed4 _SelfLuminousColor;
|
fixed _SelfLuminousSpeed;
|
fixed _SelfLuminousIntensity;
|
fixed _SelfLuminousMin;
|
fixed _SelfLuminousMax;
|
|
fixed4 frag(v2f i): SV_Target
|
{
|
|
// textures
|
fixed3 outcolor = tex2D(_MainTex, i.uv1);
|
fixed3 channels = tex2D(_ChanTex, i.uv1);
|
|
outcolor *= 2;
|
outcolor *= i.lgt;
|
|
#ifndef QUALITY_LOW
|
fixed timeadd = _Time.y * 5 * _FlowSpeed;
|
|
fixed uvshiftH = (timeadd - floor(timeadd)) * _FlowDirectionH;
|
fixed uvshiftV = (timeadd - floor(timeadd)) * _FlowDirectionV;
|
|
fixed channelsB = tex2D(_ChanTex, i.uv1 + fixed2(uvshiftH, uvshiftV)).b;
|
outcolor += _FlowColor * channels.r * _FlowIntensity * channelsB;
|
|
fixed delta = _SelfLuminousMax - _SelfLuminousMin;
|
outcolor += _SelfLuminousColor * channels.g * ((delta * 0.5 * sin(_Time.y * 10 * _SelfLuminousSpeed)) + (2 - _SelfLuminousMin) * 0.5) * _SelfLuminousIntensity;
|
#endif
|
|
return fixed4(outcolor.rgb, 1);
|
}
|
|
ENDCG
|
|
}
|
|
Pass
|
{
|
Name "EMISSION_FLOW_NEW"
|
|
Cull Back
|
Fog
|
{
|
Mode Off
|
}
|
|
CGPROGRAM
|
|
#pragma target 3.0
|
#pragma vertex vert
|
#pragma fragment frag
|
|
#pragma multi_compile_fwdbase
|
#pragma multi_compile QUALITY_LOW QUALITY_MED QUALITY_HGH
|
|
#pragma exclude_renderers flash
|
|
#include "UnityCG.cginc"
|
#include "SnxxzCG.cginc"
|
|
struct vertexInput
|
{
|
half4 vertex: POSITION;
|
half3 normal: NORMAL;
|
half4 tangent: TANGENT;
|
half2 texcoord0: TEXCOORD0;
|
half2 texcoord1: TEXCOORD1;
|
};
|
|
struct v2f
|
{
|
// basics
|
half4 pos: SV_POSITION;
|
half2 uv0: TEXCOORD0;
|
half2 uv1: TEXCOORD1;
|
half3 lgt: TEXCOORD5;
|
};
|
|
// assets
|
uniform sampler2D _MainTex;
|
|
uniform sampler2D _EmissiveTex;
|
fixed4 _EmissiveColor;
|
fixed _EmissiveSpeed;
|
fixed _EmissiveIntensity;
|
fixed _EmissiveMin;
|
fixed _EmissiveMax;
|
|
uniform sampler2D _FlowTex; uniform float4 _FlowTex_ST;
|
uniform float4 _FlowColor;
|
uniform float _FlowSpeed;
|
uniform float _PannerX;
|
uniform float _PannerY;
|
|
uniform half _Hit;
|
|
v2f vert(vertexInput v)
|
{
|
v2f o = (v2f)0;
|
|
// pos and uv tex coord
|
o.pos = UnityObjectToClipPos(v.vertex);
|
o.uv0 = v.texcoord0;
|
o.uv1 = v.texcoord1;
|
|
o.lgt = 0.6 + _Hit;
|
return o;
|
}
|
|
fixed4 frag(v2f i): SV_TARGET
|
{
|
// textures
|
fixed3 outcolor = tex2D(_MainTex, i.uv0);
|
fixed3 channels = tex2D(_EmissiveTex, i.uv0);
|
|
outcolor *= 2;
|
outcolor *= i.lgt;
|
|
fixed delta = _EmissiveMax - _EmissiveMin;
|
outcolor += _EmissiveColor * channels.g * ((delta * 0.5 * sin(_Time.y * 10 * _EmissiveSpeed)) + (2 - _EmissiveMin) * 0.5) * _EmissiveIntensity;
|
|
float2 uvTimeShift = (float2(0.0, (-1 * (_Time.g * _FlowSpeed))) + i.uv1);
|
float flowR = tex2D(_FlowTex, TRANSFORM_TEX(uvTimeShift, _FlowTex)).r;
|
float2 pannerUV = (i.uv1 + (float2(_PannerX, _PannerY) * _Time.g));
|
float flowG = tex2D(_FlowTex, TRANSFORM_TEX(pannerUV, _FlowTex)).g;
|
|
float clip = tex2D(_FlowTex, TRANSFORM_TEX(i.uv1, _FlowTex)).b;
|
|
float3 flowColor = (flowR * flowG * _FlowColor.rgb * _FlowColor.a) * 5 * clip;
|
return fixed4(outcolor.rgb + flowColor, 1);
|
}
|
|
ENDCG
|
|
}
|
|
Pass
|
{
|
Name "MONSTERNORMAL"
|
|
Cull Back
|
Lighting Off
|
Fog
|
{
|
Mode Off
|
}
|
|
CGPROGRAM
|
|
#pragma target 3.0
|
#pragma vertex vert
|
#pragma fragment frag
|
|
#pragma multi_compile_fwdbase
|
#pragma exclude_renderers flash
|
|
#include "UnityCG.cginc"
|
#include "SnxxzCG.cginc"
|
|
struct vertexInput
|
{
|
half4 vertex: POSITION;
|
half3 normal: NORMAL;
|
half4 tangent: TANGENT;
|
half2 texcoord: TEXCOORD0;
|
};
|
|
struct v2f
|
{
|
// basics
|
half4 pos: SV_POSITION;
|
half2 uv1: TEXCOORD0;
|
half3 lgt: TEXCOORD1;
|
};
|
|
// assets
|
uniform sampler2D _MainTex;
|
// properties
|
uniform half _Hit;
|
uniform half _BaTi;
|
uniform half _Rate;
|
|
v2f vert(vertexInput v)
|
{
|
v2f o;
|
|
// pos and uv tex coord
|
o.pos = UnityObjectToClipPos(v.vertex);
|
o.uv1 = v.texcoord;
|
|
half hit = _Hit;
|
half3 bati = half3(_BaTi, 0, 0) * sin(_Time * _Rate);
|
o.lgt = 1 + hit + bati * bati;
|
|
return o;
|
}
|
|
fixed4 frag(v2f i): SV_Target
|
{
|
|
// textures
|
fixed3 outcolor = tex2D(_MainTex, i.uv1);
|
outcolor *= i.lgt;
|
|
return fixed4(outcolor.rgb, 1);
|
}
|
|
ENDCG
|
|
}
|
}
|
|
FallBack "Diffuse"
|
}
|