I'm currently working on a top-down game (orthogonal, like "Harvest Moon: Friends of Mineral Town" for example).
I'm trying to introduce a day/night cycle with moving shadows over the time of day.
In 3d this probably wouldn't even be worth questioning but in 2d it has proven to be a bit more complex.
I tried a few approaches using Light2D and LightOccluder2D or using a shader, added normal maps to the sprite and got the lighting of the sprite itself working.
First i used the Light2D node. Combined with the LightOccluder2D (and a shader so that the sprite wouldn't catch its own shadow) worked pretty well. Until i realized that the shadows were allways casted with infinite length because in 2d you can't really assign a z value that "shortens" the shadows. (i still hope i simply missed something :D)
Now I'm using a fragment() - processor approach in with i tell the shader via parameter in which direction the "sun" is currently shooting its rays. This approach would be fine as for every pixel will receive the same light direction and therefore it creates that "directional light" effect. Downside is I would have to deal with casting the shadows myself.
Is there either a way to "shorten" the shadows a Light2D is casting or is there a way to cast shadow within the light() shader by myself?
Or is there maybe even a way easier approach on how to create a day night - lighting?
Thanks in advance!