Light effects can be used in a number of ways; to draw the player’s attention to something important on the island or to create a specific atmosphere, such as a ghostly setting.
Before beginning this tutorial, refer to Using the Emissive Input documentation from the Unreal Engine documentation site for background knowledge for this workflow.
Basic Material Node Set Up
Follow along below for a basic tutorial on how to create a pulsing light beacon.
Create a new material in your project, then double-click the material thumbnail to open the Material Editor.
Add the following nodes:
Time node
Sine node
Constant3Vector node
ComponentMask node
TextureCoordinate node
ConstantBiasScale node
MaterialFunctionCall node
Saturate node
2 X OneMinus node
2 X Abs node
2 X Vertex NormalWS node
5 X Multiply node
Change the mesh to a Cylinder in the Preview window.
Add a color to the Constant 3Vector expression node and plug it into the B input of the first Multiply node.
Right-click the Constant 3Vector expression node to change it to a Parameter node, then plug the bottom input into the B input on the first Multiply node.
Drag off the top output of the Constant 3Vector expression node and plug it into the A input of the first Multiply node and the Base Color input on the Main Material Node.
Drag off the Multiply node and plug it into the Emissive Color input on the Main Material node.
This configuration creates the base color and multiplies the light effect on the emissive input. You can change the brightness of the color by changing the numerical value of the Alpha input in Material Expression Vector Parameter in the Details panel.
Material Function Call Set Up
The MaterialFunctionCall node provides a way to use material functions in a material. To create the shape of the light material, a material function called BreakOutFloat2Component is used to determine how much space the vertices of the material occupy.
To use the material function, do the following:
Select the MaterialFunctionCall (UnspecifiedFunction) node in the material graph to open the node's options in the Details panel.
From the Details panel, click the Material Function dropdown menu and select BreakOutFloat2Component.
The UnspecifiedMaterial node turns into the BreakOutFloat2Component node.
Material Light Effect
Now the mesh is ready for material effects to be applied.
Drag off the TextureCoordinate node and plug it into the BreakOutFloat02Components node. This configuration determines how much space the vertices occupy.
Drag off the G output from the BreakOutFloat02Component node and plug it into the ConstantBiasScale node. This provides a parameter for the texture space between -1 and +1.
Expand the ConstantBiasScale node and change the Bias value to -0.5 and the Scale value to 2.0.
Drag off the ConstantBiasScale node and plug it into the first Abs node. This converts all negative values into positive values.
Drag off the first Abs node and plug it into the 1 Minus node.
Drag off the 1 Minus node and plug it into the second Multiply node A and B inputs. This inverts the values of the Y- and X-axes.
Drag off the second Multiply node and plug it into the third Multiply node A input.
Select the Main Material Node, in the Details panel select Blend Mode > Translucent.
Drag off the third Multiply node and plug into the Opacity input on the main root node.
This configuration keeps the cylinder shape intact as the fading effect is applied to the top of and bottom of the cylinder.
Material Shape Effect
Drag off the VertexNormalWS node and plug it into the ComponentMask node.
Select the ComponentMask node, check only the B input in Material Expression Component Mask in the Details panel.
Drag off the ComponentMask node and plug it into the second Abs node.
Drag off the second Abs node and plug it into the Saturate node.
Drag off the Saturate node and plug it into the OneMinus node.
Drag off the 1 Minus node and plug it into the B input on the third Multiply node.
Although the Opacity input isn’t highlighted, the cylinder changes shape in the preview window. It’s now shaped like a light beam from a flashlight.
Material Pulse Effect
Drag off the Time node and plug it into the Sine node.
Drag off the Sine node and plug it into the fourth Multiply node A input.
Drag off the Constant node and plug it into the Multiply node B input and change the numerical value to 15.0. This provides the scale for the pulsing effect.
Drag off the fourth Multiply node and plug it into the fifth Multiply node A input.
Drag off the VertexNormalWS node and plug it into the fifth Multiply node B input. This scales the pulsing according to the vertex normals of the mesh.
Drag off the fifth Multiply node and plug it into the World Position Offset input on the Material root node.
Now the cylinder pulses in time to the sine wave.
Apply this effect to a mesh in the viewport. You can edit the speed of the sine wave to create a slower pulse of light.