Fading from one light to another with UI Slider

I have two lights in my scene. I can change the light intensity and the light temperature with a slider.
Now I would like to have an additional slider that fades between the lights.
So in the middle value both lights have the actual intensity of the light.
Turning the slider up, the bottom light is dimming to zero and turning the slider down, the upper light is dimming to zero.

Has anybody an idea to do something like that?

Thank you!

I answered this once, and the system threw my answer away. Attempt #2.

Either have a BP with two lights in, or a BP in the level that has the lights.

The BP contains a variable 0 - 1 called X. As you make X nearer to 1, light A becomes brighter. As you make X nearer to 0, light B gets brighter.

All you have to do then is bind the widget slider to X.

( Tell me if you need a bit of code )

It’s just (1 - Slider Value) (provided that it’s 0 to 1 and interpolated to brightness values).

Or, if you use absolute numbers for your slider without interpolation: let’s say it goes from 0 to 16. Then the brightness of Light 1 will be Slider Value, and the brightness of Light 2 will be (16 – Slider Value)

In your widget:

Thank you for your answer.
I have a BP with two lights in my level. I make a new variable there. Float, right?


And then just bind the widget slider to this variable?
unfortunately this doesn´t work. Do you have a bit of code for me please?

Thank you!

Thank you for your answer.

I tried this, but all lights are off when clicking on the slider. And I can not move the slider anymore.

How schould I connect this function to my other nodes?
Sorry for this question, but I´m new to this kind of stuff.

When you place the slider in the UMG, in the details, there’s a ‘bind’ button, which lets you say what the slider is connected to. When you hit that bind button, it will take you to a function definition. That’s where you put the above.

Sorry, I’m not sure which bit you are struggling with. Just come back if you need more info :slight_smile:

Here’s my take on this:

A widget with 2 sliders and 2 lights sitting in the level.

Image from Gyazo