Capturing in-view light levels for a realistic exposure meter

Hi there. I’m currently working on a photography system for my game. I have a widget that has a meter at the bottom of it that I want to move between -2 and 2+ based on the brightness of what you are looking at. It doesn’t have to be accurate, I just want it to move based on the general light level.

My first thought was simply to shoot a trace from the middle and get the overall light level from whatever object it hits, or to possibly have a collision sphere wherever you’re looking and to see how much it overlaps any lights, but as a pretty newish dev I’ve no idea how to make these happen.

I’ve done some research and failed to find any direct answers. One of the more intuitive solutions was to get the actors distance from lights as well as each light’s intensity and then deduce it from that. This sounds solid, but I have no clue as to how I’d implement something like this. Anybody have any advice? Thanks in advance!

Use the plugin below, should work with 5.6 too. It would give very accurate results in terms of detecting light and luminance levels.

Simply you can create an actor, attach this Lightawareness component to it.
On mouse move, make a line trace cameraforward vector → normalize * 10000 +forward ---->SetActorWorldLocation(HitLocation)

Lightawareness->GetLightLevel

PS: Detecting light accurately is not easy as it seems in unreal engine afaik there is not built in method, could be something deep in megalights maybe (did not check). Since is no built in method, the nicest one is this plugin to detect light conditions on any actor independent of Light Source Type, Screen Effects and similar.

Other methods such as:

Getting light actors and checking distance or accessing their intensity, getting screen brighness etc still would not give you accurate results since light can bounce, reflect, depends on engine settings, angle and so on. This plugin is simply a reverse calculation.

Just cosmetic access can be done via:

Option A: You can get a very small render target on the object screen like 8x8 black and white, resolve pixels 0-255 and add all, then divide with 64 would be give or take the result you wanted.

Option B: Custom post process anode with eyeadaptation to output current exposure , this would be the least accurate on some cases however cosmeticly would work on most cases.

Thank you so much for recommending me this, it seems to be exactly what I’m searching for. I tried to initially install it in 5.5, but every time I getting told that the LightAwareness module is missing or built with a different engine version. When I say yes to rebuild I get this error:

Engine modules are out of date, and cannot be compiled while the engine is running. Please build through your IDE.

As a coding noob, this is really confusing and I can’t even find an .sln file to open in Visual Studio.

Interestingly, I installed it into 5.4, and I got the same errors, but after rebuilding it launched perfectly fine. I verified the 5.5.4 engine as some people suggested, but that didn’t do anything. I really would like to use 5.5, do you have any recommendations or should I ask on the Git page?