Camera Fade Shader Stopped Working in LWRP (Solved)

Edit: Found solution. See next post.

I recently switched to the lwrp. My Camera fade-in/out shader has suddenly stopped working. Does anyone have any advice, or possibly a replacement that works with LWRP? I have included the shader and camera scripts.

FadeCameraShader

// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
// Taken from: https://github.com/iBicha/Unity-Simple-Fade-Camera
// http://brahim.hadriche.me/
// Author: Brahim Hadriche

Shader "Hidden/FadeCameraShader"
{
    Properties
    {
        _MainTex ("Texture", 2D) = "white" {}
        _opacity ("Opacity", Range (0, 1)) = 0
        _Color ("Fade Color", Color) = (0,0,0,1)
    }

    SubShader
    {
        // No culling or depth
        Cull Off ZWrite Off ZTest Always

        Pass
        {
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
          
            #include "UnityCG.cginc"

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

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

            uniform sampler2D _MainTex;
            uniform float _opacity;
            uniform float4 _Color;

            v2f vert (appdata v)
            {
                v2f o;
                o.vertex = UnityObjectToClipPos(v.vertex);
                o.uv = v.uv;
                return o;
            }  

            fixed4 frag (v2f i) : SV_Target
            {
                fixed4 col = tex2D(_MainTex, i.uv);
                col = col * _opacity + _Color * (1-_opacity);
                return col;
            }
            ENDCG
        }
    }
}

FadeCamera.cs

using UnityEngine;

[ExecuteInEditMode]
// ReSharper disable once CheckNamespace
public class FadeCamera : MonoBehaviour
{
    [Range(0f, 1f)]
    public float opacity = 1;
    public Color color = Color.black;

    private Material _material;
    private float _startTime;
    private float _startOpacity = 1;
    private int _endOpacity = 1;
    private float _duration;
    private bool _isFading;
    private static readonly int Opacity = Shader.PropertyToID("_opacity");

    public void FadeIn(float duration = 1)
    {
        _duration = duration;
        _startTime = Time.time;
        _startOpacity = opacity;
        _endOpacity = 1;
        _isFading = true;
    }

    public void FadeOut(float duration = 1)
    {
        _duration = duration;
        _startTime = Time.time;
        _startOpacity = opacity;
        _endOpacity = 0;
        _isFading = true;
    }

    void Awake()
    {
        _material = new Material(Shader.Find("Hidden/FadeCameraShader"));
    }

    void Start()
    {
        FadeIn();
    }

    void OnRenderImage(RenderTexture source, RenderTexture destination)
    {
        if (_isFading && _duration > 0)
        {
            opacity = Mathf.Lerp(_startOpacity, _endOpacity, (Time.time - _startTime) / _duration);
            // ReSharper disable once CompareOfFloatsByEqualityOperator
            _isFading = opacity != _endOpacity;
        }

        // ReSharper disable once CompareOfFloatsByEqualityOperator
        if (opacity == 1f)
        {
            Graphics.Blit(source, destination);
            return;
        }

        _material.color = color;
        _material.SetFloat(Opacity, opacity);
        Graphics.Blit(source, destination, _material);
    }
}

Found a simple solution to this as a fullscreen image effect. The shader and effect scripts are below.

CameraFade.cs

/*
* Camera Fade
* Image Effect by Dan Flanigan, djflan@gmail.com
* Written for Delve on 8/4/2019
*/

using System;
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;

[Serializable]
[PostProcess(typeof(CameraFadeRenderer), PostProcessEvent.AfterStack, "ImageFx/CameraFade")]
public sealed class CameraFade : PostProcessEffectSettings
{
    [Range(0f, 1f), Tooltip("Opacity Value. 0 = Full Transparency, 1 = Full Opacity")]
    public FloatParameter opacity = new FloatParameter { value = 0f };
    [Tooltip( "Fade Color")]
    public ColorParameter fadeColor = new ColorParameter {value = Color.black};
}

public sealed class CameraFadeRenderer : PostProcessEffectRenderer<CameraFade>
{
    public override void Render(PostProcessRenderContext context)
    {
        var sheet = context.propertySheets.Get(Shader.Find("Hidden/CameraFade"));
        sheet.properties.SetColor("_Color", settings.fadeColor);
        sheet.properties.SetFloat("_Opacity", settings.opacity);
        context.command.BlitFullscreenTriangle(context.source, context.destination, sheet, 0);
    }
}

CameraFade.shader

/*
* Camera Fade Shader
* Image Effect by Dan Flanigan, djflan@gmail.com
* Written for Delve on 8/4/2019
*/

Shader "Hidden/CameraFade"
{
    HLSLINCLUDE

        #include "Packages/com.unity.postprocessing/PostProcessing/Shaders/StdLib.hlsl"

        TEXTURE2D_SAMPLER2D(_MainTex, sampler_MainTex);
        float _Opacity;
        float4 _Color;

        float4 Frag(VaryingsDefault i) : SV_Target
        {
                float4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord);
                col = col * _Opacity + _Color * (1-_Opacity);
                return col;
        }

    ENDHLSL

    SubShader
    {
        Cull Off ZWrite Off ZTest Always

        Pass
        {
            HLSLPROGRAM

                #pragma vertex VertDefault
                #pragma fragment Frag

            ENDHLSL
        }
    }
}

Sample script controlling fade effect (on object that contains pp fx layer)
PostFxController.cs

using DG.Tweening;
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;

public class PostFxController : MonoBehaviour
{
    private PostProcessVolume effectsVolume;
    private CameraFade cf;
    public float fadeDuration = 1f;

    void Awake()
    {
        effectsVolume = GetComponent<PostProcessVolume>();
    }

    void Start()
    {
        if (effectsVolume != null)
        {
            if (effectsVolume.profile.TryGetSettings(out cf))
            {
                cf.Opacity.value = 0f;
               
                //Use DOTween to tween opacity value;
                DOTween.To(() => cf.Opacity.value, x => cf.Opacity.value = x, 1f, fadeDuration).OnComplete(Finished);
            }
        }
    }

    void Finished()
    {
        //Disable fade and kill this script
        cf.enabled.value = false;

        DestroyImmediate(this);
    }
}