Sunday 1 November 2015

Water Surface Shader

Being an island environment water place quite a big roll in emerging the player leading them to believe that they are indeed on an island. The first water material i used was from the Water Plains Content pack from the Epic Market Place, however the water was creating a lot of lag and although it looked good didn't fit the art style. 

So instead i decided to take a stab at creating my own water material that could be tweaked as customized to fit the art style plus other similar art styles of new projects requiring water.










Unreal Has a few features that help making materials much easier. One of these features is 
the Material Parameters. Material Parameters allow
you the ability to change certain values of a material externally and have the material update
live applying the changes. 

This becomes extremely useful and powerful as tweaking values in the material requires the whole 
calculation of the material to be recalculated and complied rather then just recalculating the material shader. 

In this list i have a varity of setting that allow me very quickly to change the colour, specularity, wave speed, surface from size, and Tile size of the water.



To break down the shader obove as simply as i can without creating a tutorial on it is to break it into its main modules. The First half of the material to the far left of the screen contain the textures that make up the foam and currents of the water. The Textures are tiled based of the water tile size however can be offset to be smaller or lager if desired. The Textures are then panned based off the speed of the water. The Make to foam move but having from on the surface the whole time doesnt look very good. So to fade the foam in and out i use a sine curve so it will oscillate between on and off.


Finally after the form was sorted out that was linked into the Second section of the shader which dealt with the color. The Colour was base off the 3 colour parameters from the Material Parameters. These where then masked but texture masked to provide colour variation. In the same way the colours where mixed together so to where the normal maps. Based off the textures the normal maps came in 3 levels. a larger more subtle map for the currents and irregular movement of the water. A smaller normal map for the waves and finally and very small and fine normal map for the overall subtle bumps and ripples of the waters surface.







No comments:

Post a Comment