- Home /
Transparent shader has no shadow?
Is it still not possible in unity to have transparent shader to cast a shadow?
what I mean is that,when I use a transparent texture and assign it to a transparent diffuse material,everything works fine except that it has no shadows.
Answer by tanoshimi · Oct 26, 2014 at 05:34 PM
What do you mean "still" not possible? What's wrong with, e.g.:
Shader "Custom/TransparentShadow" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader {
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
LOD 200
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#pragma surface surf Lambert addshadow
sampler2D _MainTex;
struct Input {
float2 uv_MainTex;
};
void surf (Input IN, inout SurfaceOutput o) {
half4 c = tex2D (_MainTex, IN.uv_MainTex);
o.Albedo = c.rgb;
o.Alpha = 0.5;
}
ENDCG
}
FallBack "Transparent/VertexLit"
}
Answer by screenname_taken · Oct 26, 2014 at 05:39 PM
If you use a transparent-cutout shader then you'll get real time shadows. If you are only going for lightmapped shadows then you can do with other shaders as well.
Your answer
Follow this Question
Related Questions
Transparent w/ Full Shadowcasting in Unity 5 1 Answer
Lighting artifacts through transparent material 0 Answers
How to force transparent shader for smooth lod transition to receive shadows? 0 Answers
Receiving Shadows On a Tranparent Shader 1 Answer
Shader on built-in render pipeline in 2019.3.0f6 not receiving shadows when light has cookie 0 Answers