Image Based Lighting and dynamic directional light

Hi !
I’m trying to rotate a directional light according to my cubemap which is recaptured on every frame.
What i’m trying to do is exactly the same thing that was done for “The human Race” here :
but I’ve no idea about how they can achieve to set the light rotation according to the image

Thanks for your time !

If you are capturing the cube map yourself, then why do you need to get the direction of the light from it? You are placing the sun yourself, you can just read its position.

My cubemap is a live 360° video from my camera, so every tick my skylight updates his captures.
If I move my 360° camera the sun will move too, and I want to have a directional light to cast shadows according to the live video.

I don’t know how to do it by analyzing the image, but perhaps you could do it by getting the geolocation, time of day, and camera gyro (if it has one) to calculate the correct sun direction.

Or you could point the camera at the sun and manually set the sun position at the start.

Depending on the situation I may have multiple light sources. I don’t think there is any trick to detect light sources (or brightest point) on a texture inside Unreal.
I will probably use OpenCV for processing the image and use the datas to update my lights.