Hey, I’m new to Unreal Engine and blueprints and I want to change the emissive value of a material in my blueprint for a day and night switch. I have columns with glowing hieroglyphs and when it gets dark the emissive should turn on and go out again during the day. I don’t know how to reference the material and change the value smoothly or lerp between two values within a specific time.
Here are the the existing nodes for the day and night switch (which I did with a tutorial), but I don’t know how to change the material now and how to link it to the time nodes.
You want a Material Instance Dynamic, described at the bottom of this doc:
More info on Material instances here:
Basically for what you’re describing, in your material, you want a Lerp node leading into your emissive material output. The A value would be your daytime texture/material, the B value would be your nightime. The Lerp Alpha value would be from a Scalar Parameter you create in the Material, lets call it “DaytimeValue”. DaytimeValue is either a 0 (fully blending the A value) or a 1(fully blending the B value) or can range between if you just want a little glow for instance.
In your BP, you will create the dynamic material and set the DaytimeValue as the first doc above shows.
Thank you But now I have the problem that I don’t know how to use Dynamic Material Instance and connect it with the time. I think there is something missing in my components and variables.
Here, the animation timeline is a simple 0-1, though you can adjust the timing as you wish.
I would suggest though that instead of using a dynamic material instance, you use a material parameter collection. This will allow you to have one global day/night effect control which you can use in multiple materials / material instances. This will make it so you don’t need to reference all of your materials with the glyphs, and will add some future-proofing in the case that you wanted to add more day / night effects.
Here is a video explaining how to set up material parameter collections: