Hi.
I want a shader that renders a texture with alpha into something in which alpha is transparent and doesn’t cast shadows and opaque part of the texture are indeed opaque and cast shadows. I managed to get this next shader but it seems that the whole texture is opaque to the engine.
Shader "Custom/alphawithshadow"{
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
}
SubShader {
Tags {
"Queue"="Transparent"
"IgnoreProjector"="True"
"RenderType"="Transparent"
}
LOD 200 Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM #pragma surface surf Lambert addshadow
sampler2D _MainTex;
fixed4 _Color;
struct Input {
float2 uv_MainTex;
};
void surf (Input IN, inout SurfaceOutput o) {
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
}
Fallback "Transparent/VertexLit"
}
The result is:
Though the texture is transparent on some part:
I am not good with shader coding. I just started learning it.