[2D Top Down] Is it possible to have both a cone of vision and lighting?

Godot Version



So, what I’m trying to accomplish both of these effects at the same time:

  1. I want the player to only be able to see objects in front of them, ie what happens in zomboid, where you can can’t see enemies behind you unless you turn around: https://youtu.be/vU5TlRgfafg?si=pto41aZFG44iF-gx&t=400

  2. I don’t want to give up lighting effects I might otherwise achieve, ie I want everything pitch black by default unless if it’s being hit by light, ie: https://cdn.akamai.steamstatic.com/steam/apps/2323400/ss_917750ba7704e97fe08dd3a929e5cddf59a1980c.1920x1080.jpg?t=1709163910

So in other words, I want for things to be illuminated if and ONLY if both it is in front of the player, and if there is otherwise light that would hit it (be it, a little flashlight the player might have, or lamps around the world, etc). Ie I don’t want something behind the player to be illuminated because it’s next to a camp fire, but I do want it illuminated if the player turns around and faces it. At the same time, if there’s a monster in front of the player coming for them but no light being shined on it, I don’t want the player to be able to see the monster - unless if they turn on their flashlight and shine the flashlight at the monster, or if the monster walks near a light fixture in the game.

I get that this would result in a very dark 2d game, but it’s meant to be a strategic tactical / stealth game, exploring and figuring out what’s around you is an important part of the game.

Anyway, I’m not sure how to achieve this or if it’s possible in godot? Like the best way I can describe achieving this is having two simultaneous lighting systems and only illuminating objects that are illuminated by both systems? But I doubt Godot supports anything like that. Is this an idea that I just can’t achieve?