Sync directional light color change in time with material color change

did you tried to make material function with this algirithm, and use it in floor material and in directional light’s light function material?

oh yes, I forgot about that, sorry…

it looks like only option you have - use the same timeline for light color and material color.

I currently have a material that cycles through different colors based on the algorithm seen here:

I can apply this to an object or a floor and it has a nice effect, but of course it doesn’t actually light up any other objects in the scene. As you can see, these two cubes I’ve placed in for testing are solid black.

I have added a dynamic directional light to the scene, but while I can get it to cycle through colors randomly using a Timeline, I can’t seem to get it in sync with the same algorithm as the material, so the colors are off. Is there any way I can achieve the effect of the changing material lighting the scene appropriately?

Things I have tried:

  1. Emissive dynamic lighting. According to the docs, you must turn off pre-computed lighting to do this, and this is not an option for my project. If there is another way to do this, I’m still open to the idea.

  2. Recreating the algorithm in blueprints for the directional light. I haven’t been successful with this, but I’m no Blueprints expert.

Thank you for your idea, but unfortunately light functions only affect the light’s intensity parameter and not the color.

You could change the light of your material in blueprints with a dynamic material instance. Just type in “create dynamic” and I’m sure it will show up. You can use it to set material parameters dynamically, you have to make a parameter for Color and plug it into emission. Then add a set vector parameter from your dynamic material

Oh! This sounds promising, will test when I get home today and update…

I created a Timeline for my Directional Light as before to change the color, changed my material to have just a vector parameter for color going into emissive, added the same color-changing Timeline to blueprints of the objects with that material applied, and used a dynamic material instance node to change the color using that Timeline.

Works perfectly, thank you!