So i've made some very misleading posts, sorry to the guys who tried to help me, but also thank you 👍
I want to recreate this flashlight effect in a game I'm making

Is this in any way possible? the effect in the reference game removes lighting and darkness/fog, so what im thinking of is it to not use the world environment and make it unshaded.

The easiest thing would be to do it with real lighting (spot light). Unless you really want a retro look.

I think those old games used stencil buffers, which aren't supported in Godot and aren't used as much in modern games.

The other option would be to do the fog with a custom shader. The lighting would still be real-time, but you could mask out an area (the volume of the flashlight) and use this to remove the fog. I think this would be the closest to that look.

But it's a little difficult to define masked areas. I guess the fog could be a full screen post process effect (by reading the depth buffer) but you'd need a way to set the area of the flashlight. My guess is that in that game the flashlight is not really 3D but just a 2D shape. This would be easier to send to the shader, as it can just be another texture. But I've never tried this, I'm just sort of guessing. I would suggest you test it using real lighting first, as you may be able to adjust the spot light properties enough that you can get the look you want without complicated shader coding.

    The flashlight in the game is actually 3D, i did try it with real lighting but it doesn't work for me as in the reference game it uses a mesh, im going to try custom shader fog.

    Rather than constantly deleting and recreating topics, maybe consider that you can just edit the OP.

    cybereality Using a custom fog shader causes other complications, like lower fps, materials not meant to be hidden in the fog, hidden in the fog, etc

    I may be wrong, but I believe the "cone" in the video is just a texture single channel + alpha. Rendering would go like this: render light-texture and circle at the end (it isn't even projected properly in the video), then render the scene with depth test enabled, and blend the light-texture with the scene so that everything appears slightly lighter than the rest. In GLSL this would be an AND + a fixed value for brightness, or a value depending on distance.

      Pixophir I may be wrong, but I believe the "cone" in the video is just a texture single channel + alpha. Rendering would go like this: render light-texture and circle at the end (it isn't even projected properly in the video)

      I'm pretty sure it's a textured(gradient - white at the tip of the cone near the arm/flashlight and midgray at the 'base' of the cone) conical mesh that is additively blended over the rest of the scene. A material pass should offer the blending option. The other issue is that the cone bypasses the depth calculation I think(could be wrong tho) so it can effectively be 'infinitely projected' through the scene. This too should be possible either via material properties or if I misrecall then custom shader material.

      Reason I suspect that it's a mesh is that there are spots where I see it accordingly intersecting with the level geometry. A fairly large amount of vertices to the circular portion of it if so tho.

      I think it was done using a stencil buffer. Sort of like shadow volumes in old games like F.E.A.R. but in reverse. I don't think you can do that in Godot without a lot of hacking.

      I mean, it may be possible with multiple viewports, but this will be really bad for performance. I think just using real-time lighting will be easiest. You can customize the penumbra so it looks more like a hard edge.

      How can I edit the penumbra? Since I don't see the option, unless its a Godot 4 feature or it can only be activated through a script.

      It's called attenuation, there are two curves you can edit.

      So I think I have gotten the flashlight effect, I had to make the fog's alpha lower, there still is a bit of fog left, and it is very bright when close to walls, but theres nothing I can do about that, thanks for the help.