Composit transparency triangles to dark fog of war plane

So I’ve been thinking about making a 2D platformer where the protagonist has a flashlight that casts a cone of light.
A key idea in the design is that everything is black except for the cone of light (which needs to use raycast logic in order to collide with the right surfaces, etc.)

But then, this is proving to be very difficult. The main idea looks like this:

  1. There is a fog of war plane in front of the entire scene, it is black.
  2. The player has a flash light which sends N rays in a cone that check for collision with the environment. Each 2 adjacent rays’ origin/collision points make a triangle whose vertexes each have “light intensity values”, with vertexes further away from the flash light being “less bright”.
  3. Each triangle is projected against the black plane from camera view
  4. Each projected triangle is composited with the black plane, giving the effect that the flashlight is “piercing” through the darkness.

And this should work for sphere-like light emission as well, and would allow for varying degrees of precision using more or less rays.
But I barely know how to make half of these things, and I don’t know which of these things can be made using shaders (supposedly making the algorithm faster).

Is there a way to do this (efficiently)?

Here is a tentative solution that does not imply compositing meshes together:

  1. There is black plane at the BACK of the entire scene.
  2. The scene is rendered in a first camera and into a texture.
  3. Based on light sources, the CPU procedurally generates triangles (light cones, etc.)
  4. A texture is applied on those triangles, with UVs being the screen coordinates.
  5. A second camera (main camera) renders the triangles

Reasoning: Instead cutting holes into a mesh (which is hard), the algorithm literally turns the “holes/light triangles” into the view. Anything that is not lit will be non-existant, or “entirely transparent”, and the back black plane will be the only thing that’s rendered.