Search Unity

Question How do you write to a Camera's original Render Texture if you changed the target?

Discussion in 'Universal Render Pipeline' started by OBXS_, Oct 15, 2021.

  1. OBXS_

    OBXS_

    Joined:
    Jun 10, 2015
    Posts:
    3
    What I'm currently doing:
    1. Setup a Temporary RenderTarget before the camera starts rendering (at RenderPipelineManager.beginCameraRendering)
    2. Assign the temporary RenderTarget to the Camera's Target texture
    3. Running a custom RenderFeature at the event 'AfterRendering'. (I want to manipulate the Temporary RenderTarget's data, and write it to the Camera's original Render Texture)
    4. Release the Temporary RenderTarget (at RenderPipelineManager.endCameraRendering)

    I'm having a lot of trouble doing the third step, How do I get something like this to work?

    What I've tried:
    - cmd.Blit(TempRT, null as RenderTexture); // Doesn't work
    - ConfigureTarget(null as RenderTexture); + cmd.DrawMesh(FullscreenQuad) // Called inside Configure, Doesn't work
    - Using a RenderTarget asset instead of a temporary RT, and render the result using RawImage. // This kinda works, but I prefer to not to have to use a Canvas to draw the final result.
     
  2. OBXS_

    OBXS_

    Joined:
    Jun 10, 2015
    Posts:
    3
    I gave up and modified URP to suit my needs