Search Unity

MultiCamera System - How do I intercept targettexture on a depth camera to apply PostFX shader.

Discussion in 'General Graphics' started by FirstTimeCreator, Aug 6, 2019.

  1. FirstTimeCreator

    FirstTimeCreator

    Joined:
    Sep 28, 2016
    Posts:
    768
    Hello,

    I am using a multi camera system, with layered depth cameras.

    I need to apply custom postFX shaders to the individual cameras before they are combined into the final render image.

    I am assuming the only way to do this if it is possible is through the command buffer?

    I have looked at OnRenderImage() but this only gets the combined image of all depth cameras and does not appear to allow me to intercept specific image renders from specific cameras in the stack.

    Say for example you have 3 Cameras, one for close range, one for medium range and one for the skybox.

    2 of these cameras are either depth or don't clear.

    I need to apply PostFX shaders to these depth cameras before they are combined into the final rendertexture, not the entire combined render of all cameras.

    If anyone could point me in the right direction, for either applying a shader or a material to these depth cameras before they are combined into the final output which is accessible in OnRenderImage(), it would be greatly appreciated.

    Thanks.
     
  2. FirstTimeCreator

    FirstTimeCreator

    Joined:
    Sep 28, 2016
    Posts:
    768
    Hmm how can you properly blit depth flagged images from cameras to combine them.

    I have decided just to covert all of my cameras to targettextures and try to manually combine them OnRenderImage().
     
  3. FirstTimeCreator

    FirstTimeCreator

    Joined:
    Sep 28, 2016
    Posts:
    768
    Nevermind, I figured it out.

    I setup a PostFX shader and turned all of my depth cameras into targettextures and blended them in the shader.

    Now the fun begins. I can do independent postFX for each individual camera. It seems Unity's new postFX system has layering built in, but it is not designed for a multi-camera setup where you need to do postFX on independent cameras regardless of layers.