WaterFragmentShader
Package: Libraries.Game.Graphics.Worlds · Inherits from: Libraries.Game.Graphics.Shaders.Shader, Libraries.Language.Object
WaterFragmentShader colors water. It is drawn after the deferred lighting, over the lit image, and reads the G-buffer's position to see what is behind the water: deeper water is darker, the edge fades into the shore, and water behind the ground is hidden. Two layers of ripples move with time, and every light shines and glints on the surface. The sky is reflected in it, strongly at low angles and hardly looking down. A river's ripples flow downstream instead. It needs the 3D camera's data (its uniform: position, time and screen size). Its settings come from WaterShaderProgram, through the push constants, after the instance buffer address.
Example Code
use Libraries.Game.Graphics.Worlds.WaterFragmentShader
WaterFragmentShader shader