Custom Area lighting without gradienting on shadow

Godot Version

Godot v4.2.2

Question

I’m trying to make a lighting system in my game which illuminates the space around a player with 2 components.

The first component is trivial and I have had no problem implementing it, it’s a point light which gets obstructed by objects. This represents the visible region to the player, not the light cone but the possible visible region.

The second component is what I’m having trouble setting up. It’s an “area” light which is meant to represent the region on the map to which the player is visible. I currently have this implement as an omnilight with size. This method works however there are a few limitations which I want to overcome.

  1. I want to color the light for each component separately however it’s difficult to truly negate the portion where the player can see and also can be seen.
  2. Because of how area lights work there is a natural gradient on the edges of surfaces. Ideally this wouldn’t be the case and it would be solid all the way up until the player cannot be seen.

Here is a simple diagram I made in ms paint illustrating the concept I’m trying to explain. The red region is the region visible to the player, where as the green region are places unseen by the player while the player can be partially seen.

This is a difficult one for sure. Is the game 2D or 3D?

I would love to see this for 2D I have been looking for a solution for some time now :slight_smile: