summaryrefslogtreecommitdiff
path: root/Assets/Art/Shaders/Effects/RimLight 1.shader
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/Art/Shaders/Effects/RimLight 1.shader')
-rw-r--r--Assets/Art/Shaders/Effects/RimLight 1.shader143
1 files changed, 85 insertions, 58 deletions
diff --git a/Assets/Art/Shaders/Effects/RimLight 1.shader b/Assets/Art/Shaders/Effects/RimLight 1.shader
index 86b593bd..f3e99007 100644
--- a/Assets/Art/Shaders/Effects/RimLight 1.shader
+++ b/Assets/Art/Shaders/Effects/RimLight 1.shader
@@ -1,26 +1,32 @@
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
-Shader "ASESampleShaders/RimLight"
-{
- Properties
- {
- // Color property for material inspector, default to white
- _Color("Main Color", Color) = (1,1,1,1)
- _Intensity("Intensity", range(0,10)) = 1
+// Unlit alpha-blended shader.
+// - no lighting
+// - no lightmap support
+// - no per-material color
+
+Shader "ASESampleShaders/RimLight" {
+ Properties{
+ _MainTex("Base (RGBA)", 2D) = "white" {}
+ _Color1("Hi Color", color) = (1.0,1.0,1.0,1.0)
+ _Step1("Color Cutoff", range(0.0,2.0)) = 0.5
+ _Color2("Lo Color", color) = (1.0,0.95,0.8,1.0)
+
+ _Intensity("Intensity", range(-1,10)) = 1
_MKGlowPower("Emission Power", range(0,10)) = 0
_MKGlowColor("Emission Color", color) = (1.0,0.95,0.8,1.0)
-
+
_StencilMask("Mask Layer", Range(0, 255)) = 1
[Enum(CompareFunction)] _StencilComp("Mask Mode", Int) = 6
_Albedo("Albedo", 2D) = "white" {}
_CutOff("Alpha CutOff", Float) = 0.5
}
- SubShader
- {
- //Tags{ "Queue" = "AlphaTest" "IgnoreProjector" = "False" "RenderType" = "Transparent" "RenderType" = "MKGlow" }
+
+ SubShader{
+ Tags{ "Queue" = "AlphaTest-1" "IgnoreProjector" = "False" "RenderType" = "Transparent" "RenderType" = "MKGlow" }
Stencil
{
Ref 255
@@ -28,16 +34,15 @@ Shader "ASESampleShaders/RimLight"
Comp[_StencilComp]
}
- //Pass
- //{
- // ZWrite On
- // //ZTest LEqual
- // ColorMask 0
- //}
-
- Tags{ "Queue" = "AlphaTest-1" "IgnoreProjector" = "False" "RenderType" = "Transparent" "RenderType" = "MKGlow" }
- Pass
- {
+ //Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
+ Tags{ "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" "RenderType" = "MKGlow" }
+ LOD 100
+
+ //ZWrite Off
+ Blend One OneMinusSrcAlpha//SrcAlpha OneMinusSrcAlpha
+ //AlphaToMask On
+
+ Pass{
Cull Front
ZTest LEqual
ZWrite Off
@@ -46,58 +51,80 @@ Shader "ASESampleShaders/RimLight"
#pragma vertex vert
#pragma fragment frag
- struct appdata
- {
- float4 vertex : POSITION;
- float2 uv : TEXCOORD0;
- };
+#include "UnityCG.cginc"
+ struct appdata_t {
+ float4 vertex : POSITION;
+ float2 texcoord : TEXCOORD0;
+ fixed4 color : COLOR;
+ float2 maskcoord : TEXCOORD1;
+ };
- struct v2f
- {
- float2 uv : TEXCOORD0;
- float4 vertex : SV_POSITION;
- };
+ struct v2f {
+ float4 vertex : SV_POSITION;
+ half2 texcoord : TEXCOORD0;
+ fixed4 color : COLOR;
+ half2 maskcoord : TEXCOORD1;
+ //fixed4 color : COLOR;
+ };
- // vertex shader
- // this time instead of using "appdata" struct, just spell inputs manually,
- // and instead of returning v2f struct, also just return a single output
- // float4 clip position
- v2f vert(appdata i)
+ //sampler2D _MainTex;
+
+ float4 _MainTex_ST;
+ float4 _Color1;
+ float4 _Color2;
+ float _Step1;
+ float _Intensity;
+
+ sampler2D _Albedo;
+ float4 _Albedo_ST;
+
+ float _CutOff;
+
+ v2f vert(appdata_t v)
{
- v2f o;
- o.vertex = UnityObjectToClipPos(i.vertex);
- o.uv = i.uv;
+ v2f o;
+ o.vertex = UnityObjectToClipPos(v.vertex);
+ o.texcoord = TRANSFORM_TEX(v.texcoord, _Albedo);
+ o.color = v.color;
+
return o;
}
- // color from the material
- fixed4 _Color;
- float _Intensity;
- fixed4 _MKGlowColor;
- float _MKGlowPower;
- sampler2D _Albedo;
- float _CutOff;
+ sampler2D _MainTex;
- // pixel shader, no inputs needed
- fixed4 frag(v2f i) : SV_Target
- {
- //_Color.rgb *= _Intensity;
- //_Color.rgb *= _Color.a;
- //_Color.rgb *= _Intensity;
- //_Color *= _Intensity;
- //_MKGlowColor = _Color;
- //_MKGlowPower = _Intensity;
- float alpha = tex2D(_Albedo, i.uv);
+ fixed4 frag(v2f i) : SV_Target
+ {
+ float alpha = tex2D(_Albedo, i.texcoord).a;
if(alpha <= _CutOff)
discard;
- _Color.rgb *= _Intensity;
- return _Color; // just return it
+
+ fixed4 col = tex2D(_Albedo, i.texcoord);
+
+ //if (col.r > _Intensity * 0.1f)
+ //discard;
+
+ float blendV = col.r;
+ float texA = col.a;
+
+ col = lerp(_Color2,_Color1,smoothstep(0,_Step1,blendV));
+
+ col *= _Intensity;
+
+ col.xyz *= texA;
+ col.a *= texA;
+ col *= i.color;
+
+ return fixed4(col.r, col.g, col.b, col.a);
}
ENDCG
}
+
+
+
}
+
} \ No newline at end of file