animating post process volume settings in the level blueprint

Hello everyone !
I am trying to implement a day/night cycle in my game : I already figured out how to make my directional light rotate depending on a float variable. But only rotating the directional light doesn’t sell the effect of night/day as much as i’d like (I want a very dark night).
I noticed that lowering the exposure setting (set to manual) in my post process volume in addition to rotating the directional light makes it really the way I want during the night; but then it is way too dark during the day.
So I came up with this node setup to link the exposure compensation to the Y value of my directional light, so that exposure compensation changes depending on the Y rotation value and better follows night and day feels.

but it only partly works : the exposure compensation in game is driven by my node setup from the level blueprint (if I try to change exposure compensation in my details panel it doesnt affect it) so I guess that works.
However the exposure isn’t updating depending on the y value : I checked in game the y value limits of my directional light and it goes from 90 (night) to -90 (night from the next day : so 45 to - 45 is day). so I mapped those values to 4 to 9 exposure compensation which are the values I need (4 for night and 9 for day). but the exposure still doesnt update.
One thing I noticed is that the exposure compensation in game is set to the last value I put in “map range unclamped”–> “out range A / B” before compiling : for example : I set “out range A” to 6 then I set “out range B” to 25 and I compile and play the game, the exposure will be set to 25. If I go back to the blueprint and I set “out range B” to 1, then compile and play the game, the exposure will be set to 1.

Any idea on why the exposure doesnt change relating to Y directional light rotation value?
thanks a lot for your help and have a great day !

Hi!
You are using the rotation you add in each frame to set the MapRangeUnclamped value instead of the actual rotation of the light

1 Like

It works perfectly, thank you so much, sorry for the late reply I was in a rush for a school project and I only could test this now !
thanks again for your help, have a great day !

While you are at it.
Dont use the level blueprint.

Create a sun actor (blueprint). Add the code into it.
Make variables to select the light actor and whatever other actors are referenced (skysphere bp?) / supposed to be in the level for it to work.

Then Make a blueprint interface.

Implement the Interface with custom functions.

Call functions from anywhere (including level BP if you really want to.)

End result difference?
Move the same end product off to any level with minimal tweaking.