1. Creating the river mesh and UV mapping in Maya
The river mesh is a plane that has been deformed to be shaped like a meandering river:
We first create a normal planar UV map; the UVs will follow the same shape as the vertices in the mesh:
Now when we animate the texture downwards in our uv space, it will follow the curves in the object.
2. Import the texture file and the water mesh into Unreal.
On the water mesh, in the Details panel under Lighting, toggle Cast Shadow off.
This will prevent the water mesh from generating a Distance Field. If the water had distance field, the water shader below would cover it completely in foam and you would not see the water texture. Without the Distance Field on the water, we will only get foam in places where the water mesh is close to or intersects other meshes.
3. In Project settings, under Lighting, toggle "Generate Mesh Distance Fields" on.
4. Create a new Material, and name it M_RiverWater.
Set up its shader as in the image below:
On The Panner node, set Speed Y to -0.5.
On the TexCoord node, set UTiling and VTiling to a value that looks good with your texture (I used 8)
5. Apply the material to the river mesh, and hit play to test.
You should see the water texture follow the bends in the river, and a white rim where the ground mesh intersects the water, like in the video above. You can control the width of the white rim using the FoamStrength parameter, and the speed of the water by changing the Speed Y value of the panner node.
This material is very simple. It could be improved by adding some deformation to imitate waves.