Now that you have become familiar with the project and some of the shader assets, next we would like to show you an awesome feature added to the Shader Graph, which we have named the Custom Interpolators.
With Custom Interpolators, you will be able to pass information from the vertex stage to the fragment stage, whether it’s vertex data or the results of custom calculations in the vertex stage for better shader performance.
Here, we are going to borrow the water shader from this Master Stack blog post to demonstrate. In order to make the water shader blend better into the Viking Village environment, we’re going to add some reflection and refraction.
While it’s different from the Master Stack demo, we made improvements to the foam so now it also appears in the water body.
We are tiling and offsetting the UVs with a Simple Noise Node to get some distortion effects on the foam texture. The foam texture itself utilizes the RGB channels to store foam textures with different densities. For a more realistic result, different channels are distorted in opposite directions. To make the foam less stiff, we use the normal maps from the waves as a mask so that the foam can blend in with the waves naturally. The calculations of the body foam are operated during the vertex stage for better shader performance.