Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Blending two perspective cameras makes depth-based effects and particles disappear (in deferred).

Discussion in 'General Graphics' started by alexandre-fiset, Apr 28, 2015.

  1. alexandre-fiset

    alexandre-fiset

    Joined:
    Mar 19, 2012
    Posts:
    699
    Hi all!

    I'm trying to blend two cameras together in order to have world space UI elements not affected by some image effects.

    If my main camera renders depth-based effects (ex: depth of field, fog) and some particles (ex: blizzard), and then I activate another camera on top of it, all aformentioned elements disappear.

    Without a second perspective camera:


    With another perspective camera as an overlay:


    Has anybody encountered the issue and found a solution?

    The only "workaround" I found is to set my second camera to forward rendering. I'm curious about why it works this way.
     
  2. Zicandar

    Zicandar

    Joined:
    Feb 10, 2014
    Posts:
    388
    It's probably because the second camera doesn't clear the g-buffer! So it's actually re-painting all opaque objects!
    So... Well, is there a reason you want to draw opaque lit objects (lit by more then 1 light or with loads of overlap) with the second camera?
     
  3. alexandre-fiset

    alexandre-fiset

    Joined:
    Mar 19, 2012
    Posts:
    699
    The first camera renders everything that is not WorldUi and Ui Layers. The second one renders only the WorldUi layer and a third one renders only the Ui layer.

    When it's orthographic like the Ui camera, it works perfectly. The problem comes when I have a perspective camera on top of another one. If it is set to Deferred, all transparent objects disappear, regardless of what I set as Clear Flags.

    After further investigation, it seems to cause problem only on some GPUs, so it might only be a bug. I'll open one with a test scene and the specs of the problematic PCs.

    For now the WorldUi camera is set to Forward and it works pretty well.
     
  4. CapnWes

    CapnWes

    Joined:
    Oct 6, 2016
    Posts:
    1
    Ayo fam did u figure it out. I'm having the same issue