Masked material actor shows if camera can see it

So I’m making a top down 2d game where the player can move their mouse around to change the rotation of their view. The flashlight follows the mouse. I only want what is in that light to be seen and every outside of it hidden with mask materials.
My idea is to attach a camera to the player and have it follow the mouse like the light does and if the camera can see an object (in viewport and not behind a wall) then it shows up in the top down camera looking down on the player that follows the player.

How can I set it up to, when actor is in camera fostrom or whatever, if the camera can see the actor in the viewport, then the object or actor is now seen on the main camera via material masks.

Idk if this makes sense. I tried to explain it the best I could.

It sounds like you need a combination of Fog of War:

with localized post process: