Search Unity

Post processing stack with render texture

Discussion in 'Image Effects' started by scw000000, Sep 7, 2017.

  1. scw000000

    scw000000

    Joined:
    Aug 31, 2017
    Posts:
    1
    Hello, I encountered some troubles when doing my image effect. Hopefully someone can give me some gudience.

    Current I got two cameras, cameraA and cameraB

    cameraA is the main camera and render final image to screen

    cameraB is a second camera which renderouput to a RenderTexture

    cameraA has a image effect, which do something like combine main texture and RenderTexture
    so I'll do a Blit in OnRenderImage

    I just skip the detail of the effect, you can image that the effect do some simple combination like
    making the main texture on left side of the screen, while RenderTexture on the right side

    however, when I want to add post processing (PP) to my final result, things got tricky.

    If I only add PP script to cameraA, then the right half of the screen won't have the PP effect.
    If I add PP script to both cameras, the image effect will not be functional and the screen only show
    either one of the texture on screen.

    And when I open the render texture, I found out that it doesn't contain the PP effect.

    So I'd like to know if there's any way to do PP in both camera so that I can combine then correctly?
     
  2. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    Stacking post-processing on two cameras always has its gotchas, but if you're just using Unity's default system of overlaying cameras (ie. one clearing depth and the other rendering everything on top to combine) then you should have your image effects on the last camera to render, and any non-depth effects should 'just work'.

    What you are describing sounds more of an execution order thing, like you need to manually call the post-processing effect after the combine,