Due to popular request, I’m posting the source code of my Unity3D Animated Water Shader. It is a complete rewrite of Alzahiel/GraphicRunner’s shader. Brief list of changes:
– It’s a surface shader (not Vertex+Fragment)
– Doesn’t require script file, all animation is done in the shader using built-in _Time variable
– Supports transparency
– Support specular lighting
– Supports reflection map
– Configurable cycle length and water flow speed
By changing normal maps tiling, main color, reflection color, specular color, flow speeds and cycle lengths a variety of effects is possible:
I’m also attaching the flow map and noise map from GraphicsRunner’s demo and water bump map and Sunny sky cube from Unity Standard Assets so that you have something to start playing with. I’m using the same normal map twice but the effect should be even cooler with two different normal maps. Enjoy!
Remember, that for flow map creation you can use FlowEd.
SOURCE CODE (Simplified BSD): AnimatedWaterShader.zip