I have a large landscape mesh, onto which I want to place smaller meshes, each with their own shader and each having a soft border controlled by an opacity bitmap. All well and good: I set Render Type and Queue to transparent, and I get the nice soft blended borders I want. But shadows are then not received by these smaller meshes.
I read that Unity's transparent type or queue (not sure) does not receive shadows. The only way I can get this to nearly work is to set my ASE shader to a render type of transparent cutout, and the queue to geometry. Then I can control the borders using the mask clip value, and still receive shadows.
But is there any way to achieve those nice soft borders via my opacity masks, AND receive shadows on those smaller meshes?
Hello! Transparency and shadows is a complicated subject, mostly related to rendering limitations present in most engines and not a matter than can be easily solved.
While it is possible to have a transparent object write on the zbuffer in order for it to handle shadows, its not possible to do it partially, meaning that the object will either receive the whole shadow information, or allow it all to go through. The intermediate solution that is present in Unity is to make use of dithering to fake this effect, but its only helpful in the casting of shadows, not the receiving.
A possible workaround, that would be far from perfect, would be to turn your transparent objects into opaque ones and use a grab pass to try and simulate transparency on your own. For this you need to be very careful on the Render Queue offset so they are rendered after all other opaque objects.
Also, when you set your shader to a Transparent Blend Mode it changes the type and queue to the transparent category, which will limit the shadow receiving capabilities, but with the following setup, you can also get alpha blend objects with receiving shadows:
CustomExample.jpg (127.91 KiB) Viewed 1045 times
Ideally, a custom solution would have to be written and implemented, as by default Unity provides no means of achieving this sort of effect without compromises.