Basic Water Shader

A very simple vertex shader for creating basic wave motion. I designed this shader for use with the Tales of Phantasia Remake for the river in Totus Village. And despite its simplicity it turned out quite well.

// --- [ structs ] --------------------------------------------
//
struct VS_OUTPUT
{
	float4 position : POSITION;
	float2 uv : TEXCOORD0;
};
 
struct VS_INPUT
{
	float4 position : POSITION;
	float2 uv : TEXCOORD0;
};
 
// --- [ vertex program ] -------------------------------------
//
VS_OUTPUT main_vp( VS_INPUT In, uniform float4x4 worldViewProj, uniform float time )
{
	VS_OUTPUT Out;
 
	Out.position = In.position;
	Out.position.y = In.position.y + 0.10 * ( sin( ( In.position.z + ( time * 30 ) ) + ( In.position.x + ( time * 30 ) ) ) ) - 0.10;
	Out.position = mul(worldViewProj, Out.position);
	Out.uv.x = ( In.uv.x - time * 5 ) * 0.5;
	Out.uv.y = ( In.uv.y + time * 10 ) * 0.5;
 
	return Out;
}
 
// --- [ fragment program ] -----------------------------------
//
float4 main_fp( float2 uv : TEXCOORD0, uniform sampler2D tex0 ) : COLOR
{
	return tex2D(tex0, uv);
}