Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question URP ScriptableRenderPass and Render Target restoration

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

  1. mluchian

    mluchian

    Joined:
    Aug 24, 2022
    Posts:
    6
    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
  2. Jens_Restemeier

    Jens_Restemeier

    Joined:
    Apr 30, 2015
    Posts:
    14
    mluchian likes this.