VertexNormal as panning direction


I’m looking into creating a material function which would plug into my Landscape master material, and provide rain/water flow that follows the shape of the terrain. In other words, wherever there is a slope, pan a texture downhill.

Here is what I have so far:

And the material:

However, as you can probably see in the video above, things don’t work quite as intended. The areas between each of the “sides” should gradually change the direction of flow, rather than forcing it into one of the 4. There also seems to be some sort of seam or gap between there as well.

Any ideas, perhaps a simpler way to do this than I have?


Nice idea. Essentially, you’d like to use your normal as a flowmap. Look into flowmap implementations in UE4

If you create a world space normal map texture of your whole terrain, you could plug that in instead of VertexNormalWS. By default, texture pixels have a blurry interpolation between eachother.
Im not sure if it would work, due to the low resolution, but maybe worth a shot.
You can capture a world space normal of your terrain using render targets. If you are unfamaliar with using render targets, you may prefer to export the terrain and bake a worldspace normal map in an external program (for initial testing purposes).