Home Game Development rendertargets – How can I refer to the render target in Unity after postprocessing?

rendertargets – How can I refer to the render target in Unity after postprocessing?

0
rendertargets – How can I refer to the render target in Unity after postprocessing?

[ad_1]

In Unity’s Universal Render Pipeline, there is a PostProcessPass class in PostProcessing.cs. What I would like to know, how I can refer to the buffer, where the postprocess effects are loaded into (final color buffer of the postprocessing effects). My first guess was the cameraTargetHandle which has got a renderTarget member, but this is always null. I am using the default implementation of BoatAttack game (link). Any help is appreciated!

        void Render(CommandBuffer cmd, ref RenderingData renderingData)
        {
         .
         .
         .
         .
         .
                else if (!m_UseSwapBuffer)
                {
                    var firstSource = GetSource();
                    Blitter.BlitCameraTexture(cmd, firstSource, GetDestination(), colorLoadAction, RenderBufferStoreAction.Store, m_Materials.uber, 0);
                    Blitter.BlitCameraTexture(cmd, GetDestination(), m_Destination, RenderBufferLoadAction.DontCare, RenderBufferStoreAction.Store, m_BlitMaterial, m_Destination.rt?.filterMode == FilterMode.Bilinear ? 1 : 0);
                   
                }
                else if (m_ResolveToScreen)
                {
                    if (resolveToDebugScreen)
                    {
                        debugHandler.BlitTextureToDebugScreenTexture(cmd, GetSource(), m_Materials.uber, 0);
                        renderer.ConfigureCameraTarget(debugHandler.DebugScreenColorHandle, debugHandler.DebugScreenDepthHandle);
                    }
                    else
                    {
                        // Get RTHandle alias to use RTHandle apis
                        RenderTargetIdentifier cameraTarget = cameraData.targetTexture != null ? new RenderTargetIdentifier(cameraData.targetTexture) : cameraTargetID;
                        RTHandleStaticHelpers.SetRTHandleStaticWrapper(cameraTarget);
                        var cameraTargetHandle = RTHandleStaticHelpers.s_RTHandleWrapper;

                        RenderingUtils.FinalBlit(cmd, ref cameraData, GetSource(), cameraTargetHandle, colorLoadAction, RenderBufferStoreAction.Store, m_Materials.uber, 0);
                        renderer.ConfigureCameraColorTarget(cameraTargetHandle);
                    }
                }
            }
        }

[ad_2]