Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question URP ScriptableRenderPass and Render Target restoration

Discussion in 'Universal Render Pipeline' started by mluchian, Sep 1, 2022.

  1. mluchian


    Aug 24, 2022
    Hey everybody,

    I have a question regarding CommandBuffer.SetRenderTarget and how it interacts with ScriptableRenderPasses in URP. According to the official CommandBuffer.SetRenderTarget docs:
    You do not explicitly need to preserve active render targets during command buffer execution (current render targets are saved & restored afterwards).

    This behaviour is somehow not consistent with ScriptableRenderPasses. As an example: if I call SetRenderTarget in a CommandBuffer for ScriptableRenderPass that executes AfterRenderingOpaques, the RenderTarget is not restored afterwards and the skybox will be rendered to the wrong render target. If this is a bug, I can submit a bug report.

    I tried searching for an answer for this behaviour, but didn't find anything useful. Is this behaviour documented better somewhere? Can somebody from the Unity dev team explain what exactly is happening here.
    Last edited: Sep 2, 2022