Hello.
The character has a shirt.
The sleeve of the shirt ends with a transparent texture, not a polygon. If I use my shader with Unity Post-Process SSAO, then I will get a shadow where it should not be.
With standard shader:
With my shader:
Shader source:
Shader "Custom/Specular"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_MainNormal ("Normal", 2D) = "bump" {}
_MainOcclusion ("Occlusion", 2D) = "white" {}
_MainSpecular("Specular", 2D) = "black" {}
_Glossiness ("Smoothness", Range(0.0, 1.0)) = 0.0
_Cutoff ("Alpha Cutoff", Range(0.0, 1.0)) = 0.55
}
SubShader
{
Cull Back
Tags
{
"Queue" = "AlphaTest"
"IgnoreProjector" = "True"
"RenderType" = "TransparentCutout"
}
LOD 100
CGPROGRAM
#pragma surface surf StandardSpecular alphatest:_Cutoff
#pragma target 2.0
sampler2D _MainTex;
sampler2D _MainNormal;
sampler2D _MainOcclusion;
sampler2D _MainSpecular;
half _Glossiness;
struct Input
{
float2 uv_MainTex;
float2 uv_MainNormal;
float2 uv_MainOcclusion;
float2 uv_MainSpecular;
};
void surf(Input IN, inout SurfaceOutputStandardSpecular o)
{
fixed4 c = tex2D(_MainTex, IN.uv_MainTex);
fixed gray = 0.21 * c.r + 0.7154 * c.g + 0.0721 * c.b;
o.Albedo = lerp(fixed3(gray, gray, gray), c.rgb, 1.4).rgb;
o.Specular = tex2D(_MainSpecular, IN.uv_MainSpecular);
o.Smoothness = _Glossiness;
o.Normal = UnpackNormal(tex2D(_MainNormal, IN.uv_MainNormal));
o.Occlusion = tex2D(_MainOcclusion, IN.uv_MainOcclusion);
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}
Also if i in material settings set Alpha Cutoff to 1.0 and in shader set a value to o.Alpha smaller than 1.0 (o.Alpha = 0.5;
)
i get this: