- Home /
Sprite plane doesn't cast shadow on another sprite plane
I'm trying to get small shadow under 1 of overlapping sprites. Basically I need to simulate shadow cast by 1 sheet of paper placed slightly above another (yeah, like Google's material design). Simply baking shadow doesn't sound good because the object above is rotating.
Scene setup is simple: 2 sprites + directional light source
Here's what I did:
1. Placed 1 sprite above the other along Z axis in 3D-view (same sorting layer, 0 and 1 position in layer)
2. Made light direction perpendicular to sprite planes
3. Enabled shadows in light source
4. Enabled shadow cast/receive in renderer settings
5. Used sprite/diffuse shader, also tried custom shader from here: https://github.com/anlev/Unity-2D-Sprite-cast-and-receive-shadows
Sprites do respond to light's direction/tint changes, but still no shadows from 1 plane on another. What am I missing?
P.S. I'm complete newbie to lighting, so consider ANY most stupid mistake you can think of.
Have you tested to see if they cast or receive shadows on/from other things? Add a sphere and put it behind and in front of your sprites and make sure. If so, it could possible be shadow bias if your sprites are very close to each other - try separating them slightly and see what happens.
Answer by FortisVenaliter · Apr 13, 2017 at 03:41 PM
Not sure on the source of the issue... But if the sprites don't have any transparency, what you can do is give them sub-objects of planes with the default material and set the renderers for those sub-planes to Cast Shadows Only mode so they only cast shadows and don't render. That, in addition to your sprite renderers, should get the job done.
Thanks for fast reply!
Those planes use .png image with alpha (semi-transparent pixels at edges) as sprite. Can this be an issue?
Your answer
