Before we delve in, if you’re seeking a tutorial on flickering lights, I’ll create one later and provide a link here. However, this tutorial is dedicated to flashing/blinking lights. For instance, consider emergency lights; they flash smoothly rather than flickering randomly.
A quick shoutout before we start: If you’d like to access a bunch of Unreal materials and import them into your project without setting them up one by one every time, you can find this material and many others, along with complete music packs, brushes, graffiti packs, etc., on my Patreon.
Let’s Begin
Go to your respective ‘Materials’ folder. If you’ve just started a fresh project, now is a great time to organize it from the beginning!:
Right click, and create a new material:
Although optional, it’s good practice to prefix your material with ‘M_’ at the beginning for easier identification later:
Double-click to open your material in the editor, then click on your ‘Master Node’ and set its ‘Blend Mode’ to ‘Light Function’ so we can use this material with built-in Unreal light sources:
After you set your ‘Blend Mode’ to ‘Light Function,’ your master node should look like this:
Now, we can begin by setting up our nodes.
- Bring in a ‘Scalar Parameter’ node (Shortcut: S + Left Mouse Click). This value will play a major role in calculating how frequently this material flashes. While lower values can be used to achieve fade in/fade out type of effects, higher values make the flashing more frequent.
- Bring in a ‘Time’ node, a ‘Multiply’ node (Shortcut: M + Left Mouse Click), a ‘Sine’ node, and a ‘Frac’ node.
- Connect the ‘Time’ and ‘Scalar Parameter’ nodes to a ‘Multiply’ node and the rest of the nodes as follows:
If you are not familiar with Unreal Engine’s material editor nodes, I explain how the ‘Time’ and ‘Sine’ nodes work in this post. I’ll create another tutorial later to explain how the ‘Frac’ node works and will link to it here.
If you want to use this material with built-in light sources, you can click on your light source, then in the detail panels, type in the term ‘Material’ and apply the material we just created to the light source’s material under the ‘Light Function Material’:
The color of the light can be adjusted from the details panel, as usual:
End Result:
(Optional Read)
As I mentioned earlier, I highly recommend checking out my tutorial on the Unreal Nodes Explained: Time Node if you’d like to learn more about modifying these setups.
For instance, with the current setup, we can achieve a ‘Only Two Color’ flashing effect. However, there are simpler methods to accomplish this type of effect, which I discuss in the tutorial linked above.