Shader fallback does not fallback to transparent as documented
hakanai
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.
Log In
Kilerbomb
I recently went through and tried various methods documented on the fallback system page, and the only one that I could get to work is putting the word "toon" in the title to fallback to a toon shader. Everything else I tested did not work.
From what I have heard, the fallback system was changed but the documentation was never updated. This really should be looked at.
ACiiL
Kilerbomb: Agree, i too found the "toon" fallback variants more dependable for transparency and cutout.