- Home /
Have a problem about receiving shadows
I'm writing my own shader and I have learned about how to receive shadows. When I applied my shader to the grass, it did receive shadows. But the problem is, when I added some wind, the grass swung but the shadows didn't. Since I'm using forward rendering with screen-space shadows, I guess that the problem appeared in generating shadow maps. So I tried to remove the fallback statement in my shader, and the shadow, as I expected, could be received but not cast on grass, directly on the ground instead (as shown blow). So I guess my shader passes could not be taken into account when generating shadow maps. What should I add into my shader? Thank you.
Answer by wechat_os_Qy07C5kWC5PVjTTAMGUIjGIx8 · Jun 21, 2021 at 05:01 AM
OK, fine. I added a shadow caster and it went right. I tried to add a shadow caster before, but forgot to enable instance. So shadow caster is neccesary even if you only receive shadows?
That's correct, yes. Only materials with a shadowcaster pass can themselves receive shadows. The reason is a bit difficult to explain, but it has to do with Unity's screen-space shadowing model.
Your answer
![](https://koobas.hobune.stream/wayback/20220613035304im_/https://answers.unity.com/themes/thub/images/avi.jpg)