Water Shader - Flow-Maps
This shader which I have put together in Unity’s Shadergraph combines a few different techniques I have discovered to produce a visually appealing body of water. Using flow-maps to control the movement of the water as well as depth fades to generate a colour change gradient as well as surface intersection foam. For this Post I am going to focus on The Flow Map aspects of the shader!
What is a FlowMap?
A flow map is a map which utlises the red and green channels in a texture, the red channel controls the speed of panning in the X axis and the Green the panning in the Y. The closer you are to the color on either axis the faster the map will flow in that direction. You can then use the gradient created between those two colours to make the texture flow in any direction you desire based on the selected colour for each pixel.
This method of working is great for flowing fluids as you can control the flow of the texture around assets you may want to place in the scene. A great example of this is rocks in a stream, you wouldnt want the water to flow straight through the rock (which would happen if you used a regular panning method) as that is not accurate to life, so we would paint a flow-map to tell the shader to move the pixels at that point of the stream to flow around the rock, we can even control the speed at which the water flows, allowing for great accuracy and level of detail.
Below is the shader-graph I produced when making the effect.