- Home /
how to cast proper self shadows from partially transparent geometry
Is there an official answer or a reasonable way to setting up casted shadows from transparent geometry ?
I have a CONCAVE geometry object with a fragment shader that sets transparency based on incoming vertex data, with some parts that can be set to be fully transparent. Given that I only have this geometry (and directional lights) in my scene, all worked fine - until I tried to have both transparency and shadows!
If I use "Queue"="Transparent" all self shadows disappear (but non-transparent shadows on other geometry is visible) If I use "Queue"="Opaque" - self shadows are visible (not modulated by opacity), but there are serious (culling) render artifacts behind transparent polygons: where there are cast shadows, these are not visible behind transparent polygons, and non-shadowed areas display self-shadowed transparent polygons If I use "Queue"="AlphaTest" - looks same as "Queue"="Opaque"
The fragment shader is based on link:VertexFragmentShaderExamples it includes "Lighting.cginc" and "AutoLight.cginc" and has the following: Tags = { "LightMode"="ForwardBase" "RenderType"="Transparent" //"Queue"="Transparent" //this kills all shadows!! } // Alpha settings AlphaToMask On Blend SrcAlpha OneMinusSrcAlpha
the fragment shader itself uses float shadow = SHADOW_ATTENUATION(i); to modify the color
thanks