1.纹理序列帧动画

Shader "Unlit/TcAnimition"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_Color("ColorTint",Color) = (1,1,1,1)
_HCount("HCount",Float) = 4
_VCount("VCount",Float) = 4
_Speed("Speed",Range(1,100)) = 1
_A("Alp",Range(0,1))=0.5
}
SubShader
{
Tags{"Queue" = "Transparent"/设置模型渲染队列为透明度混合/ "IngnoreProjector" = "True" "RanderType" = "Transparent"}
Pass
{
//Tags{"LightMode" = "ForwardBase"}
ZWrite Off
Blend SrcAlpha OneMinusSrcAlpha

        CGPROGRAM
		sampler2D _MainTex;
		float4 _MainTex_ST;
		float4 _Color;
		float _HCount;
		float _VCount;
		float _Speed;
		float _A;

        #pragma vertex vert
        #pragma fragment frag
		#include "UnityCG.cginc"
        struct a2v
        {
            float4 vertex : POSITION;
            float2 uv : TEXCOORD0;
        };

        struct v2f
        {
            float2 uv : TEXCOORD0;
            float4 vertex : SV_POSITION;
        };


        v2f vert (a2v v)
        {
            v2f o;
            o.vertex = UnityObjectToClipPos(v.vertex);
            o.uv = TRANSFORM_TEX(v.uv, _MainTex);
			
            return o;
        }

        fixed4 frag (v2f i) : SV_Target
        {
			float time = floor(_Time.y*_Speed);
			float row = floor(time/_HCount);
			float column = time- row*_HCount;

			half2 uv = i.uv+half2(column,-row);
			uv.x /=_HCount;
			uv.y /= _VCount;
            fixed4 col = tex2D(_MainTex, uv);
			col *=_Color;
            return float4( col.xyz,_A*col.w);
        }
        ENDCG
    }
}
FallBack "Transparent/VertexLit"

}

2.纹理平移

Shader "Unlit/TcMoveAni"
{
Properties
{
_MainTex ("BaseLayer", 2D) = "white" {}
_DetaliTex ("UpLayer", 2D) = "white" {}
_ScrollX("BaseSpeed",Float) = 1.0
_Scroll2X("UpSpeed",Float) = 1.0
_Multipler("LayerHLT",fLOAT) = 1
}
SubShader
{
Pass
{

        CGPROGRAM
		sampler2D _MainTex;
		float4 _MainTex_ST;
		sampler2D _DetaliTex;
		float4 _DetaliTex_ST;
		float _ScrollX;
		float _Scroll2X;
		float _Multipler;

        #pragma vertex vert
        #pragma fragment frag
		#include "UnityCG.cginc"
        struct a2v
        {
            float4 vertex : POSITION;
            float2 uv : TEXCOORD0;
        };

        struct v2f
        {
            float4 uv : TEXCOORD0;
            float4 vertex : SV_POSITION;
        };


        v2f vert (a2v v)
        {
            v2f o;
            o.vertex = UnityObjectToClipPos(v.vertex);
            o.uv.xy = TRANSFORM_TEX(v.uv, _MainTex)+frac(float2(_ScrollX,0.0)*_Time.y);
			o.uv.zw = TRANSFORM_TEX(v.uv,_DetaliTex)+frac(float2(_Scroll2X,0.0)*_Time.y);				
            return o;
        }

        fixed4 frag (v2f i) : SV_Target
        {
			fixed4 baseLayer = tex2D(_MainTex,i.uv.xy);
			fixed4 upLayer = tex2D(_DetaliTex,i.uv.zw);

            fixed4 col = lerp(baseLayer,upLayer,upLayer.a);
			col.rgb *=_Multipler;
            return col;
        }
        ENDCG
    }
}
FallBack "Diffuse"

}
3.顶点动画


Shader "Custom/VTAni"
{
Properties
{
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Manitude("Mangitude", Float) = 1
_Frequency("Frequency",Float) = 1
_InvWaveLength("InvWaveLength",Float) = 10
_Speed("Speed",Float) = 0.5
}
SubShader
{
Tags{"Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType"="Transparent"
"DisableBatching" = "True"}//该模型依靠模型空间计算顶点动画,不进行批处理合并
Pass{
//Tags{"LightMode" = "ForwardBase"}
ZWrite Off
Blend SrcAlpha OneMinusSrcAlpha
Cull Off//双面可见

    CGPROGRAM

    sampler2D _MainTex;
	float4 _MainTex_ST;
	float4 _Color;
	float _Manitude;
	float _Frequency;
	float _InvWaveLength;
	float _Speed;
	#pragma vertex vert
    #pragma fragment frag
	#include "UnityCG.cginc"

    struct a2v
        {
            float4 vertex : POSITION;
            float2 uv : TEXCOORD0;
        };

        struct v2f
        {
            float2 uv : TEXCOORD0;
            float4 pos : SV_POSITION;
        };

	v2f vert(a2v v){
		v2f o;
		float4 offset ;
		offset.xzw = float3(0.0,0.0,0.0);
		offset.y = sin(_Frequency*_Time.y + v.vertex.x * _InvWaveLength + v.vertex.y*_InvWaveLength + v.vertex.z*_InvWaveLength )*_Manitude;
		o.pos = UnityObjectToClipPos(v.vertex+offset);
		o.uv = TRANSFORM_TEX(v.uv,_MainTex);
		o.uv += float2(0.0,_Time.y*_Speed);
		return o;
	}
	fixed4 frag(v2f i):SV_Target{
		fixed4 c = tex2D(_MainTex,i.uv);
		c.rgb *= c;
		return c;
	}
	ENDCG
}
}
FallBack "Transparent/VertexLit"

}