For my current project (Lowboat) I created some shaders with vertex animations. Since there is not much information on this subject, I thought posting the following shader might be helpful. Of course, any tipps on how to improve it are welcome. ![]()

Shader "Vertex Animations/Dolphin" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
_Shade ("Shade Cubemap(RGB)", CUBE) = "" { Texgen CubeNormal }
_AnimationSpeed ("Animation Speed", Range(1, 50)) = 50
_AnimationAmount ("Animation Amount", Range(0.01, 0.5)) = 0.5
_AnimationLength ("Animation Length", Range(0.001, 10)) = 0.1
}
SubShader {
Tags {"IgnoreProjector"="True" }
Pass {
Name "BASE"
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma fragmentoption ARB_precision_hint_fastest
#pragma glsl_no_auto_normalization
#include "UnityCG.cginc"
sampler2D _MainTex;
samplerCUBE _Shade;
fixed4 _MainTex_ST;
float _AnimationSpeed;
float _AnimationAmount;
float _AnimationLength;
struct appdata {
fixed4 vertex : POSITION;
float2 texcoord : TEXCOORD0;
float3 normal : NORMAL;
};
struct v2f {
fixed4 pos : POSITION;
float2 texcoord : TEXCOORD0;
float3 cubenormal : TEXCOORD1;
};
v2f vert (appdata v)
{
v2f o;
float s = sin(_Time.y * _AnimationSpeed + (v.vertex.z + v.vertex.x * 0.6f)* _AnimationLength) * _AnimationAmount * v.vertex.z;
v.vertex.y += s;
o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex);
o.cubenormal = mul (UNITY_MATRIX_MV, float4(v.normal,0));
return o;
}
fixed4 frag (v2f i) : COLOR
{
fixed4 col = tex2D(_MainTex, i.texcoord);
fixed4 cube = texCUBE(_Shade, i.cubenormal);
return fixed4( cube.rgb * col.rgb, col.a);
}
ENDCG
}
}
Fallback "VertexLit"
}