My only-visible-in-the-mirror shader which I use for my moustache has been showing outside the mirror for users with shaders blocked.
Shader "Custom/Magic moustache Transparent"
{
Properties
{
_Color ("Fallback Color (set to transparent)", Color) = (0,0,0,0)
_Colour ("Actual Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
}
SubShader
{
Tags
{
"RenderType" = "TransparentCutout"
"Queue" = "AlphaTest"
}
LOD 200
CGPROGRAM
#pragma surface Surface Standard addshadow fullforwardshadows
#pragma target 3.0
sampler2D _MainTex;
struct Input
{
float2 uv_MainTex;
};
half _Glossiness;
half _Metallic;
fixed4 _Colour;
bool IsInMirror()
{
return unity_CameraProjection[2][0] != 0.f || unity_CameraProjection[2][1] != 0.f;
}
void Surface(Input IN, inout SurfaceOutputStandard output)
{
if (!IsInMirror())
{
discard;
}
fixed4 colour = tex2D(_MainTex, IN.uv_MainTex) * _Colour;
output.Albedo = colour.rgb;
output.Metallic = _Metallic;
output.Smoothness = _Glossiness;
output.Alpha = colour.a;
}
ENDCG
}
FallBack "None"
}
According to documentation at:
One of the specially treated strings is:
"Transparent",
This perplexes me, as clearly putting this into the name of my shader has not worked in the slightest, despite the documentation claiming that it should.