完整的着色器代码

Shader "Unlit/Simple Particle Unlit"
{
    Properties
    {
        _MainTex("Texture", 2D) = "white" {}
        _TimeOffset("Noise Offset", Range(0, 100)) = 0.0
    }
    SubShader
    {
        Tags { "Queue" = "Transparent" "RenderType" = "Opaque" }
        LOD 100 
 
        Blend One One // 加法混合
        ZWrite Off // 关闭深度测试
 
        Pass
        {
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag          
            // 实现模糊效果
            #pragma multi_compile_fog
 
            #include "UnityCG.cginc"
 
            struct appdata
            {
                float4 vertex : POSITION;
                fixed4 color : COLOR;
                float3 uv : TEXCOORD0;
            };
 
            struct v2f
            {
                float3 uv : TEXCOORD0;
                UNITY_FOG_COORDS(1)
                float4 vertex : SV_POSITION;
                fixed4 color : COLOR;
            };
 
            sampler2D _MainTex;
            float4 _MainTex_ST;
 
            float _TimeOffset;
 
            v2f vert(appdata v)
            {
                v2f o;
 
                // 奇怪的定点动画
                float sineFrequency = 5.0;
                float sineAmplitude = 4.0;
 
                float time = _Time.y + _TimeOffset;
                float sineOffset = sin(time * sineFrequency) * sineAmplitude;
 
                float agePercent = v.uv.z;
 
                float3 vertexOffset = float3(0, sineOffset * agePercent, 0);
 
                v.vertex.xyz += vertexOffset;
                o.vertex = UnityObjectToClipPos(v.vertex);
 
                // 从保存在颜色顶点输入的粒子系统接收数据,并将该数据用于初始化颜色
                o.color = v.color;
 
                o.uv.xy = TRANSFORM_TEX(v.uv, _MainTex);
 
                // 初始化tex coord变量
                o.uv.z = v.uv.z;
 
                UNITY_TRANSFER_FOG(o,o.vertex);
                return o;
            }
 
            fixed4 frag(v2f i) : SV_Target
            {
                //采样纹理
                fixed4 col = tex2D(_MainTex, i.uv);
 
                // 让纹理颜色和粒子系统的顶点颜色输入相乘
                col *= i.color;
 
                float particleAgePercent = i.uv.z;
                float4 colourRed = float4(1, 0, 0, 1);
 
                // 根据粒子寿命百分比,从纹理颜色插值为红色
                col = lerp(col, colourRed * col.a, particleAgePercent);
 
                // 应用模糊效果
                UNITY_APPLY_FOG(i.fogCoord, col);
                return col;
            }
            ENDCG
        }
    }
}