When you use an Absolute World Position node to create a material, you are returning the world position of the pixel being drawn (including or excluding material offsets). Drawing the pixel across the world position creates movement, which results in the material moving across the mesh that sits in the same world position.
The Panner node moves UVs in a direction according to the value you assign to the different axes. Play around with the values to see the material change directions.
-
Create a new material in the your project, then double-click the material thumbnail to open the Material Editor.
- Use the following nodes:
- Texture Sample node
- Panner node
- Divide node
- Component Mask node
- Absolute World Position node
-
Select the Texture Sample node and add a patterned texture to the sample in the Details panel.
-
Drag off the Texture Sample node RGB pin and plug it into the Base Color input on the Main Material Node.
-
Drag off the Absolute World Position node and plug it into the Component Mask node.
-
Drag off the Component Mask node and plug it into the A input on the Divide node.
-
Drag off the Divide node and plug it into the UVs input of the Texture Sample node.
-
Change the B input value of the Divide node. This determines the size of the patterned texture on the mesh. The higher the number, the larger the pattern appears. Alternatively, the smaller the number, the smaller the pattern.
-
Break the link between the Divide node and the Texture Sample node, then place the Panner node between the Divide and Texture Sample nodes.
-
Drag off the Divide node and plug it into the Panner node Coordinate input.
-
Drag off the Panner node output pin and plug it into the UVs input on the Texture Sample node.
- Change the Speed values on the Panner node to change the direction the material moves across the mesh.
Using positive values in the Panner node causes the pattern to move upward. Negative values cause the pattern to move downward.
To move the texture to the right, set the X-axis to a negative value and the Y-axis to a positive value. Reverse the negative and positive values of the axes to move the texture to the left.
Plugging WorldPosition directly into the texture sample produces a lot of tiling repeats because the UEFN world units are so small. You can divide the world position by a value to reduce tiling; this is achieved by setting the Units per Texture (texel density).
The mask limits the Float3WorldPosition (X, Y, Z) to the float2 for the X and Y axes.
Because the material is sampling the position of each pixel in the world, the material stays in the same place, regardless of how the mesh is placed, until moved with the Panner node.