first shader

Good evening, I am new to shader programming. I would like to simulate a circle shaded from black to white based on the distance of pixels from the center of the shader. How can I render the gradient effect? it results in pixelated image

// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'

Shader "Light/Lanterna"
{
   Properties
   {
       _Color("Main Color", Color) = (1,1,1,1)
       _Center("Center", Vector) = (0,0,0)
   }

       Subshader
   {
       Pass
       {
         CGPROGRAM
        #pragma vertex  vert
        #pragma fragment frag

         uniform half4 _Color;
         float3 _Center;
         struct vertexInput
         {
             float4 vertex : POSITION;

         };

         struct vertexOutput
         {
           float4 pos : SV_POSITION;
           float4 col0 : COLOR;

          };

         vertexOutput vert(vertexInput i)
         {
             vertexOutput o;
             float s = length(i.vertex - _Center)*3;
             
             if (s > 5)
             {
               
                 o.col0 = float4(1, 1, 1, 1);
             }
             else
             {
               
                 o.col0 = float4(0, 0, 0, 0);
             }

           
             o.pos = UnityObjectToClipPos(i.vertex);
             return o;

         }

         half4 frag(vertexOutput u) : COLOR
         {
             u.col0 += smoothstep(0.5,1,u.pos.z);
             return u.col0;
         }
             ENDCG

        }

   }
}

You seem to be choosing between black and white on the vertex shader. Depending on how the mesh you’re using for rendering looks like, this may yield a “blocky” circle. What you want to do is use lerp() or smoothstep() in the fragment shader to calculate the color per-fragment, not per-vertex.

Alternatively, make sure that the mesh is good enough for a circle. You may be able to take advantage of vertex color interpolation to render the gradient for you, for instance if your mesh is a triangle fan with only one vertex at the center of the circle and many vertices evenly spaced at the edge of the circle: drawing the center vertex black and the edge ones white would automatically result in a gradient.