Detect light perceived by player camera

Is there a way to detect the sunlight intensity at a given spot? I want my character to look away when facing the sun or another intense light source but couldn’t find a good approach for this yet.

Thanks for your answer. The problem here is, that the light source (in case of the sun) is not at the position of the actual sun image at the sky. For other light sources that are not far away from the player, a simple trace would be a solution though.

One way you could go about this is tracing from right in front the eyes of your character into lightsources in a radius and the level directional light, AKA “the sun”. If you hit the lightsource or nothing at all is because your character is seeing it and hence you can make it look in another direction. This is however a very basic implementation that you should work on to improve (like takingn in acount the actual direction the character is facing before doing the traces, calculating the intensity of the light hiting the character eyes based on distance, etc,etc), but it would be a good place to start from my perspective.