Unreal Engine Tutorial: How to Create a Ripple Effect Material

The next experiment in this series is similar in setup to the shockwave pulse, but this time we're going to create a ripple effect that expands outwards across a plane.

To get started, the material domain needs to be set to Surface, blend mode to Translucent, and shading model to Unlit. For parameters, we want one vector parameter, Pulse Color, and four scalar parameters, Pulse Speed, Ring Spacing, Pulse Sharpness, and Fade Radius. I'm setting default values of 25 for Pulse Speed, 20 for Ring Spacing, 8 for Pulse Sharpness, and 250 for Fade Radius.

Starting on the node graph, we add an Absolute World Position node and this time instead of a separate origin parameter, we're going to use an Object Position node masked to its XY channels as the origin. The Object Position is subtracted from the World Position and the result is passed through a Length node to get the distance from each pixel to the plane center.

Next we add a Time node and multiply it by the Pulse Speed parameter. This value is subtracted from the Length output so the ripple effect will continuously move outward over time. To control the spacing of the rings, we then divide the result by the Ring Spacing parameter, with higher values producing fewer rings that are spread further apart.

In order to create the repeating wave pattern, we're going to first pass the result of the Divide operation through a Sine node. Since the resulting rings were too wide, I'm going to use a Power node to create more narrow bands of ripples. The Pulse Sharpness parameter is fed into it to control the sharpness level. A Clamp (0 to 1) then removes the negative portion of the sine output so only the rings are visible.

Now that we have the ring mask, we can multiply it with the Pulse Color parameter to apply the desired color for the ripple effect. Connecting it to Emissive Color outputs the visible rings, and connecting the same mask directly to Opacity makes sure only the rings themselves are visible against the plane.

Before we connect the ring mask to Opacity, I'm going to add a fade effect towards the edges of the plane. The Length output from earlier is divided by the Fade Radius parameter to normalize the pixel distance, then passed through a OneMinus node so the center is fully visible while the ripples fade away towards the edges. We then clamp the result to cut off anything beyond the fade radius, and finally multiply this fade mask with the ring mask to get the final value for the Opacity.

Finally, apply the material to a plane mesh and we can see the ripples expanding outwards as shown below.

The project files for this and other Absolute World Position experiments are available on Github: https://github.com/RohitKotiveetil/UnrealEngine--WorldPositionExperiments

Comments