revival/game/Assets/Shaders/stencil.shader

63 lines
1.4 KiB
Plaintext
Raw Normal View History

2021-04-24 03:06:03 +02:00
Shader "KernelPanic/stencil"
{
Properties
{
[HideInInspector]_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader
{
// No culling or depth
2021-04-26 00:44:43 +02:00
// Cull Off ZWrite Off ZTest Always Blend SrcAlpha OneMinusSrcAlpha
Tags {"RenderType"="Opaque" "Queue"="Geometry"}
2021-04-24 03:06:03 +02:00
Pass
{
2021-04-26 00:44:43 +02:00
Stencil
{
//Ref 1
//Comp equal
//Pass keep
//ZFail keep
}
2021-04-24 03:06:03 +02:00
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
};
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = v.uv;
return o;
}
2021-04-26 00:44:43 +02:00
2021-04-24 03:06:03 +02:00
sampler2D _MainTex;
fixed4 frag (v2f i) : SV_Target
{
float4 c = tex2D(_MainTex, i.uv);
2021-04-26 00:44:43 +02:00
return lerp(float4(1,0,0,0),float4(0,0,0,0),step(c.a,0.001));
2021-04-24 03:06:03 +02:00
2021-04-26 00:44:43 +02:00
// return float4(1,1,1,1);
2021-04-24 03:06:03 +02:00
}
ENDCG
}
}
}