Download

Skylight only for specific areas

Hi,
I’m currently working on a top down strategy game with two worlds, one dark world with moonlight and one bright world with sunlight. I managed to control the sunlight with a lightmask material, but I can’t figure out how to do it with the skylight. I need skylight in the lightened areas but not in the dark areas.

I tried to fake the skylight using emissive materials as shown in the image. But the tree with emissive material in the dark obviously glows, and without emit the tree has complete black shadow what doesn’t look good in the lightened area. So I have to change the materials in game, that kind of works, but its getting very complicated especially if objects are moving from light into dark and have many materials.

I would be very grateful for any help or suggestions!