I am creating a day-night cycle for my 2D side scrolling game and I have a big problem. The problem can be best understood if you look at the following image:
Problem is very simple: the moon should always be behind terrain (otherwise it would look weird) and terrain should always be behind a light-map (in order for light-map to draw shadows over the terrain).
However, the moon should also appear in front of the light-map, since at night it shouldn’t be affected by the light-map darkness over the terrain (light-map should only apply to the terrain).
Essentially, I have the following situation: A should be behind B, B behind C and C behind A (circular ordering). Is there a trick to solve this problem?