Is there any way to get _CameraOpaqueTexture set for a shader (or Scene Color node for a shadergraph) on a stacked URP overlay camera?

In the past I used multiple cameras that had the ‘Uninitialized’ background type flag set so I could stack various camera effects together. Now unity causes the ‘Uninitialized’ background to render a mustard yellow background, so I’m switching my code to camera stacks. The problem is one of my shaders uses _CameraOpaqueTexture, but that is only available on the base camera, which is not the camera I need the effect on. I tried to rewrite the shader as a shadergraph but that one uses _CameraOpaqueTexture under the hood, I think, so no good. Is there some way I can either get this value set, or some other way I can get the rendered texture in between overlay cameras to to draw on before sending it to the screen?

I just have the same problem in untiy 6000.0.40f1. What I need is simply get a screen texture, even catch only base camera is fine, but _CameraOpaqueTexture is BLACK in the end. And I test Unity 6000.1, still have this issue. But In Unity 2022.3 work fine.

I made a render feature to capture the scene color for use in stacked overlay cams, then I changed my shaders to use “_BaseSceneColor” instead of “_CameraOpaqueTexture”. This is the code if anyone is interested:

    public class SceneColorCaptureFeature : ScriptableRendererFeature
    {
    [System.Serializable]
    public class Settings
    {
        public string GlobalTextureName = "_BaseSceneColor";
        public CameraRenderType CameraType = CameraRenderType.Base;
        public RenderPassEvent PassEvent =
            RenderPassEvent.AfterRenderingTransparents;
    }

    public Settings settings = new();

    CapturePass pass;

    public override void Create()
    {
        pass = new CapturePass(settings);
    }

    public override void AddRenderPasses(
        ScriptableRenderer renderer,
        ref RenderingData renderingData)
    {
        if (renderingData.cameraData.renderType != settings.CameraType)
            return;

        renderer.EnqueuePass(pass);
    }

    class CapturePass : ScriptableRenderPass
    {
        readonly int globalTextureID;

        class PassData
        {
            public TextureHandle source;
        }

        public CapturePass(Settings settings)
        {
            renderPassEvent = settings.PassEvent;
            globalTextureID =
                Shader.PropertyToID(settings.GlobalTextureName);
        }

        public override void RecordRenderGraph(
            RenderGraph renderGraph,
            ContextContainer frameData)
        {
            var resources =
                frameData.Get<UniversalResourceData>();

            TextureHandle source =
                resources.activeColorTexture;

            if (!source.IsValid())
                return;

            TextureDesc desc =
                renderGraph.GetTextureDesc(source);

            desc.name = "SceneColorCopy";
            desc.depthBufferBits = 0;
            desc.msaaSamples = MSAASamples.None;

            TextureHandle destination =
                renderGraph.CreateTexture(desc);

            using var builder =
                renderGraph.AddRasterRenderPass<PassData>(
                    "Capture Scene Color",
                    out var passData);

            passData.source = source;

            builder.UseTexture(source, AccessFlags.Read);

            builder.SetRenderAttachment(
                destination,
                0,
                AccessFlags.Write);

            builder.SetGlobalTextureAfterPass(
                destination,
                globalTextureID);

            builder.AllowPassCulling(false);

            builder.SetRenderFunc(
                (PassData data, RasterGraphContext ctx) =>
                {
                    Blitter.BlitTexture(
                        ctx.cmd,
                        data.source,
                        new Vector4(1, 1, 0, 0),
                        0,
                        false);
                });
        }
    }
}