Lightning only specific areas

I’m currently working on a top down strategy game with two worlds, one dark world with moonlight and one bright world with sunlight. The world is split up into small areas, and when you conquer an area, the area turns bright.

But I’m stuck with the lightning. I don’t know how to light only specific areas. I experimented with light function materials to mask the sunlight, that works for one area, but I can’t add multiple light functions to light for example 20 areas. I don’t think its a good solution, it’s just getting to complicated.
And I can’t put a masked sunlight over every area, I think the performance would be very bad.

I would be very grateful for any help or suggestions!

To make it more clear, here is a screenshot of the look I am trying to achieve. But I am not able to multiply and expand the light areas within the game.

Hi, never did exactly something like you want to do so no guarantuees that this will work in your case, but you could try to use one lightfunction and then use a rendertarget specifiying the light and dark areas. Then if you want to add new light areas, you could additive add another texture to the rendertarget. So you would need one texture per light area and if you want to light that area, you would add that texture to the render target via additive blend.

Here is something similar explained step by step Creating a Height Field Painter with Blueprints and Render Targets | Unreal Engine Documentation and a longer video Blueprint Drawing to Render Targets Overview | Live Training | Unreal Engine - YouTube

1 Like

That does sounds really good! I will try that.

Thank you very much!