Sun position calculator and Point Ligth BP

Hi all. I made the change in the time of day in the Level blueprint using the Sun position calculator plugin. I want to make it possible to change the intensity of the lamp depending on the time, but I’m not good at BP. I welcome any help and advice.


Hey @Ilas
You can do something like this inside the SunSky blueprint in the UpdateSun function:

This is a Math Expression with following equation:
(((pow((x - Noon), 2)) * LightTimeFactor) + MaxIntensity)
Which will generate a parabola like this for your intensity (Y=intensity, X=SolarTime):

The site for the graph: https://www.desmos.com/
The equation: -.5*(x-12)^2+20

And copy this to another folder in your project:
image

image

3 Likes

I will definitely try, thanks

1 Like

Looks like I didn’t write my goal correctly.) I want PointLigth to dim during the day and get brighter later in the day. I can assume that I need to somehow associate the “hour” parameter with the set intensity in the BP of my lamp.



Oh…
So you want to set your lamp to be the one beeing adjusted. Sry, I thought lamp was a typo and you meant light as in directional light.

Then you can do something similar. I can later create an example. But you could:
-Use an event dispatcher to call the function in your lamp from the sun
-Use a reference of your lamp inside the SunPosition. Then you can use the lamp reference with SetIntensity like in the screenshot I showed you. And set the LightTimeFactor in the MathExpression to be positive, like 0.5 instead of -0.5

Hey @Ilas
here is an example.

-Inside SunSky I created a timer on EventBeginPlay
image

-The looped function updates the time of the SunSky

The lamp now gets an update and an new intensity when the sun gets updated

427_SunAndLamp.zip (521.6 KB)

1 Like

Thank you very much helped a lot

1 Like