I was trying to add some shadows from clouds to my 2.5D RPG to give a more lively feeling to the world map so I’m sharing a quick writeup on the 2 ways I’ve tried.
The first option I’ve tried is to simply create a plane on which I applied scrolling noise and alpha cutout, using the noise as alpha. This does block some light from reaching the ground and is quite easy to do.
This solution has a problem though: Unity creates a shadowmask for real time moving objects, so objects below are either lit or non-lit; this gives a constant level of shadowing where light is obstructed by our cloud cover.
This was not bad but I really wanted something less… uniform. The way to solve this was to inject a custom renderer feature in our pipeline and add screenspace shadows.
What I did for my first try was to get the color from the main texture, convert the color from RGB to HSV, adjust the Value channel according to a generated noisemap and an exposed multiplier, than convert it back to RGB and output to master node. We also add some scrolling to our noise, and can also expose a property to set the player position so that the scrolling noise looks like it’s scrolling in world space and not screen space.
Here’s the result: we can see that the shadows are not clear cut anymore and there is more or less light passing through depending on the location.