I am trying to achieve an effect where meshes on one layer have shadows of a certain strength,
and meshes on another layer have shadows of a different strength,
and for these to be cast from the same light source.
Is the idea to have the shadows these objects receive to be of a different strength, or the shadows they cast to be of different strength.
Either way, the answer is “no”, using the built in shaders at least.
If you want them to receive shadows of different strength, you could write a custom shader that modifies the shadow intensity for all lights that cast on it.
If you want them to cast shadows of different strength, you’d need a custom shadow caster pass that does dithered transparency only during the shadow pass.
I saw you on a different shader/shadow issue!Thanks for responding to this one.
Is this helpful at all to this^?
It would be the casting of them that would be a different strength. Like a ghost that only casts half the strength of the shadow strength the light is hitting it has set.
I have very little knowledge of shaders, would the “custom shadow caster pass” be something I could get online, or Asset Store, or easily written?
As you can see, if I have a mesh that is semi-transparent, casting shadows, I get the dithered effect here as well. But, I would like it to be fully shaped and not have the noticeable dither pattern
To have a selectively transparent shadow that doesn’t look obviously dithered you have to use soft shadows. Unity’s shadows do not support translucency any other way. In general efficient semi-transparent shadows are an unsolved problem for real time rendering.
that colorizes the shadows (including transparency) that you put on meshes that are being cast upon (receiving).
But I can’t figure out how I could achieve my effect without doubling all meshes, or using two light sources (which would doubly light the environment anyway). Of course, this would be crazy performance wise.
I just can’t believe such a seemingly simple effect is so difficult to achieve.
Yeah. That’d let you colorize all shadows that object receives. And yes, you’d have to use two sets of shadow receiving geometry to do what you’re looking to do. And if you want a “single” ground to be receiving both opaque and “transparent” shadows, you’d have to have two lights and have the semi-transparent shadows just be darkening the already lit normal surface.
The alternative is to completely replace Unity’s lighting & shadow system and write your own with it’s own custom shadow maps.
Alternatives like VSM or MSM (Variance / Moment Shadow Maps) can sort of support semi-transparent shadows, again mainly via dithering and blurring, but the blurring is an innate part of the way those techniques work so it’s “free”, plus you get nice penumbra blurring.
Transparency in general is a massive approximation and collection of hacks that get you something kind of close to what you expect to see. Transparent shadow maps are just another step further beyond that with even more hacks.
Amazing! Thank you for all the resources, I will be sure to look into them, I think they’ll help me understand the problem better and maybe even find a solution.
Thanks Bgolus, will let you know if I find or implement anything further on this