37 lines
1.1 KiB
Plaintext
37 lines
1.1 KiB
Plaintext
Shader "AIGame/HomeExplorerCutout"
|
|
{
|
|
Properties
|
|
{
|
|
_MainTex ("Tex", 2D) = "white" {}
|
|
_Key ("Key", Color) = (1, 0, 1, 1)
|
|
}
|
|
SubShader
|
|
{
|
|
Tags { "Queue"="Transparent" "RenderType"="Transparent" "IgnoreProjector"="True" }
|
|
Blend SrcAlpha OneMinusSrcAlpha
|
|
ZWrite Off
|
|
Cull Off
|
|
Pass
|
|
{
|
|
CGPROGRAM
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
#include "UnityCG.cginc"
|
|
sampler2D _MainTex;
|
|
float4 _Key;
|
|
struct appdata { float4 vertex : POSITION; float2 uv : TEXCOORD0; };
|
|
struct v2f { float4 vertex : SV_POSITION; float2 uv : TEXCOORD0; };
|
|
v2f vert(appdata v) { v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.uv = v.uv; return o; }
|
|
fixed4 frag(v2f i) : SV_Target
|
|
{
|
|
fixed4 c = tex2D(_MainTex, i.uv);
|
|
float d = distance(c.rgb, _Key.rgb);
|
|
c.a = smoothstep(0.18, 0.42, d);
|
|
if (c.a < 0.02) discard;
|
|
return c;
|
|
}
|
|
ENDCG
|
|
}
|
|
}
|
|
}
|