For the past little while I've been working on a light detection method for use in a stealth game like the Splinter Cell or Thief games. I wasn't happy with most of the other implementations I saw as most of them used raycasting the distance from light sources and didn't seem all that accurate. So, after reading up on how The Dark Mod did their light detection (http://forums.thedar...ystem-las-work/) , I decided to try and implement a similar system in UE4. After a lot of work I finally got it where I like it, mostly.
It works by having a SceneCapture focused on an octohedron located in the same space as the player. The capture is sent to a RenderTarget which then has every pixel scanned and the brightness of each pixel calculated. The brightness value of the brightest pixel is then returned for whatever you may need it for (eg AI visibility calculations). I've also considered averaging the brightness of every pixel instead of simply returning the brightest pixel, but I haven't tried it yet. In the video, you can see an example of how you might display the lighting information to the player in the form of a progress bar. There's also debug information in the form of a raw float value, and a display of the RenderTarget. Advantages over the "common" implementations (ie raycasting):
This method takes into account the color of a light source. Some colors will make the player more visible than others. The "perceived luminescence" method from here was used: https://stackoverflo...ss-of-rgb-color
This method works with indirect light bouncing. With raytracing method, the easiest way to implement it was if the line of sight to the player was broken, the player was completely hidden. This would look very unrealistic if there was a lot of bounced light behind the object blocking the line of sight.
This method works with pretty much any light source, including spotlights.
Some of the current limitations:
It's only as accurate as your Volumetric Lightmap. During testing I had a lot of problems with directional light being cast on the player even though he was indoors. I also had to increase the settings of the Volumetric Lightmap quite a bit to get it to be accurate enough for my tastes, eg next to doorways.
I'm pretty happy with it at the moment, though it's a shame I had so much trouble with directional lights having their indirect bounce applied to the character through walls. Any comments or suggestions on how to improve the system are welcome.