I made this shader in the fall of 2019 using Unity2019.2.0f1’s shader graph as part of my work for the project Jetpack Penguin. The shader uses vertex displacement and texture scrolling to create a waterfall effect.
The Shader Graph
This is the shader graph I used to achieve this effect. The graph gives the user control over how a texture scrolls across the surface, along with detailed control over how the water moves.
There are 3 parts to this graph:
- the logic used for vertex displacement
- the logic used to scroll the texture
- nodes to handle roughness, normal, metallic maps
Section 1: Vertex Displacement
The movement of the plane seen in the gif above is done using this part of the graph. What this is doing is it’s generating 2 gradient noise maps that scroll in opposing directions. These two different maps are overlaid using a multiply node. The resulting noise is multiplied by a gradient that we generate based on the UV map of the object to clamp the displacement so it displaces more the further we get from the base of the waterfall. This clamped noise is multiplied by the MovementScale property and added to our position map to generate the vertex displacement we see.
The various noise properties allow the user to have fine control over how the water displaces. The MovementScale property allows the user to scale the noise differently depending on the direction, which allows you to, for instance, only have the waterfall displace along the x-axis.
Section 2: Texture Scrolling
This section is simpler than the last. Here we simply multiply the speed at which the texture scrolls by time, and then use that to offset the UVs of our albedo map. By making TextureScrollSpeed a Vector 2, I allow the user to control vertical as well as horizontal scrolling of a given texture.
Section 3: The Rest of it
These nodes handle roughness maps and normal maps. They convert roughness to smoothness the same way that the Autodesk shader does, so that this shader is compatible with that one. There is also a user-controlled slider to control the metallic value. It would improve the shader if I gave the user the ability to use a full map instead of just a slider, but that level of detail is unnecessary for the intended use of this shader.