How to blit cam view to object material texture in URP?

I have been following Ben Swee’s distortion tutorial on youtube https://www.youtube.com/watch?v=YSAqivxqC3w and he is showing how to do the distortion in the legacy graphics pipeline, with the simple OnRenderImage method and blit onto a material’s Render Texture. Obviously this won’t work in URP…

So, first I’ve created a global volume, and attached the volume component that will manipulate the materials properties. Next I created a render feature, and render pass within that (rt click → CreateRenderingURP Render Feature), and attached it to the URP High Fidelity renderer. However, I can not get the effect to work.

Below is my RenderFeature and RenderPass script. It produces an error. I simply don’t understand how to do this, and it was guess work, so I need to understand it from scratch. Anyway, what I am trying to do is take the frame rendered by the PostFXCam and blit it onto a temp RenderTexture with the material. Then set the temp as the texture on my PostFXSphere object’s matrial’s shader’s Texture Property.

using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;

public class DistortRenderFeature : ScriptableRendererFeature
{
   
    private URPPostFXDistortRenderPass _uRPPostFXDistortRenderPass;

    public override void Create()
    {
        _uRPPostFXDistortRenderPass = new URPPostFXDistortRenderPass();
    }
    public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
    {
        renderer.EnqueuePass(_uRPPostFXDistortRenderPass);
    }

    public class URPPostFXDistortRenderPass : ScriptableRenderPass
    {
        private GameObject _postFXSphere;
        private Material _mat;
        private RTHandle src, temp, dest;


        public URPPostFXDistortRenderPass()
        {
            renderPassEvent = RenderPassEvent.BeforeRenderingPostProcessing;
        }
       
        public override void OnCameraSetup(CommandBuffer cmd, ref RenderingData renderingData)
        {
            if (_postFXSphere == null)
            {
                _postFXSphere = GameObject.FindGameObjectWithTag("PostFXSphere");
                if (_postFXSphere != null)
                {
                    _mat = _postFXSphere.GetComponent<Renderer>().sharedMaterial;
                }
            }

            RenderTextureDescriptor desc = renderingData.cameraData.cameraTargetDescriptor;
            src = renderingData.cameraData.renderer.cameraDepthTargetHandle;
            temp = RTHandles.Alloc(src.referenceSize.x, src.referenceSize.y); // not needed

        }
        public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
        {
            CommandBuffer cmd = CommandBufferPool.Get("DistortRenderFeature");
            cmd.Clear();

            VolumeStack volumes = VolumeManager.instance.stack;
            DistortVolComp uRPDistortVolumeComponent = volumes.GetComponent<DistortVolComp>();
           
            dest = src;

            if (uRPDistortVolumeComponent.IsActive())
            {
                _mat.SetColor("_ScreenTint", (Color)uRPDistortVolumeComponent.TintColor);

                //cmd.Blit(src, temp);
               _mat.SetTexture("_RenderTex", src.rt);
                //cmd.Blit(src, dest);
               
                

            }
            context.ExecuteCommandBuffer(cmd);
           
            CommandBufferPool.Release(cmd);
        }

        public override void OnCameraCleanup(CommandBuffer cmd)
        {
            temp.Release();
        }
    }
}

TL;DR:

Is there someone kind enough to teach me how to do the Ben Swee’s distortion effect in URP?