Search Unity

ImageEffects with Two Cameras

Discussion in 'Scripting' started by shmo, May 3, 2011.

  1. shmo

    shmo

    Joined:
    Oct 27, 2010
    Posts:
    21
    I have painted myself into a corner and need help getting out. I have a two camera setup, with the "main" camera rendering at depth 1 and a "UI" camera (not using GUI) rendering at depth 2 with "Don't Clear" set.

    When I came to add ImageEffects on to the main camera, I realised the flaw in my plan (in that the imageeffects do not work, unless I disable the UI camera).

    Is there any way out of this mess? Do I have to write some "compositor" post processing effect? Or am I doomed?

    Any advice greatfully appreciated.
     
  2. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    Perhaps you could render the main scene camera to a render texture, applying the image effect. Then, apply this texture to a plane object in the view of the GUI camera. If the GUI camera is positioned so that it is looking straight at the "screen" where the other camera's view is displayed it will look much the same as it would if the two views were overlaid. However, this technique might create other problems, say if you need to perform raycasts into the scene based on the based on the mouse position.
     
  3. shmo

    shmo

    Joined:
    Oct 27, 2010
    Posts:
    21
    Thanks for the pointers andeee