- Home /
Semi-transparent shader with Shadows
I need a shader that supports semi-trasparent objects and cast shadows, it doesn't need to receive it. Anybody knows one or knows if is possible to write one?
Next, only opaque objects cast and receive shadows; that means if you use built-in Transparent or Particle shaders then you'll get no shadows. In most cases it's possible to Transparent Cutout shaders (for objects like fences, vegetation etc.). If you use custom written Shaders, they have to be pixel-lit and use Geometry render queue. Objects using VertexLit shaders do not receive shadows either (but can cast shadows just fine).
Source: http://unity3d.com/support/documentation/Manual/Shadow%20Troubleshooting.html
I just need to cast the shadow from the transparent object, I don't need to receive it.
Answer by Bunny83 · May 11, 2011 at 12:05 AM
Just with shaders that's not really possible, but there might be a way if you have only some of those transparent objects and you have the time (and knowledge) to implement your own stencil shadow renderer. But it's a nasty piece of work (i did it one time just for educational purpose). If it needs support for multiple lights it gets even more complicated. A high light or object count will have a great impact on your performance. Also I'm not sure if a stencil buffer is available in Unity (i guess you can't change the device context parameters).
Answer by Eric5h5 · May 10, 2011 at 11:07 PM
It's not really possible. http://forum.unity3d.com/threads/9909-No-shadows-visible-on-Transparency-Shaders-!!?p=71027&viewfull=1#post71027
Documentation make sounds like it is possible.
"...If you use custom written Shaders, they have to be pixel-lit and use Geometry render queue. Objects using VertexLit shaders do not receive shadows either (but can cast shadows just fine)."
Source: http://unity3d.com/support/documentation/$$anonymous$$anual/Shadow%20Troubleshooting.html
@HVilela: There's nothing you quoted that makes it sound possible. Did you read the link I posted? Aras wrote the shadow system; it's a bit possible he knows what he's talking about....
Answer by Linmst · Mar 23, 2013 at 08:23 PM
http://wiki.unity3d.com/index.php?title=TransparentShadowReceiver
Hey, just check this out. However, it still shows some warning when I get it into my project even if it works.
So I still need someone who is good at Shader stuff for me to figure this out. (( I'm now doing a project and I just cannot be sure if I could use this shader script if I build it as a .apk file.