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

Multiple Composited Camera support for deferred rendering?

Discussion in 'Editor & General Support' started by NathanWarden, Oct 11, 2010.

  1. NathanWarden

    NathanWarden

    Joined:
    Oct 4, 2005
    Posts:
    663
    It seems to work sometimes and other times it doesn't, but, when I set my main camera to draw with the clear flags set to "Depth Only" and a background camera with the clear flags set to "Skybox", with the main camera on a higher depth setting than the BG camera, the background I get the background area smeared with the main camera and the BG camera seems to be completely ignored.

    If I swap between forward and deferred rendering the problem turns on and off.

    Is this just a limitation of deferred rendering, or is this a bug?

    I've attached two images showing what I'm talking about.

    Thanks,
    Nathan
     

    Attached Files:

  2. NathanWarden

    NathanWarden

    Joined:
    Oct 4, 2005
    Posts:
    663
    Has anyone else at least seen this problem, it seems to be randomly happening :(
     
  3. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    Yeah, could be that with Deferred Lighting this does not quite work (since deferred lighting is more involved in switching render targets etc. than forward).

    Why do you have to use two cameras? If it's for performance (culling some layers earlier) purposes - maybe you can use one camera, and set layerCullDistances instead?
     
    mikelortega likes this.
  4. Noisecrime

    Noisecrime

    Joined:
    Apr 7, 2010
    Posts:
    1,998
    Same problem for me.

    I have a project that renders a 'product' over a gradient background, the background needs to be static, whilst the product can be 'orbited' via the main camera. For simplicity I created a background camera, clear flags set to depth only as its a full screen background and set its depth lower than the main camera. Main camera clear flags set to 'don't clear'.

    In forward rendering it works fine, in defered I lose the background. I'm sure there are various workarounds to this, but disappointing to lose such a simple method for rendering behind the main camera.
     
  5. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,613
    Did anyone figure this out? I'm seeing it under 3.4.2 - when the game starts things are OK, but as soon as I start spawning effects and stuff, I'm suddenly only able to render *either* my environment camera *or* my first-person-weapon camera. Is it a bug? A misconfiguration? Or what?

    If I switch the first-person-weapon camera to use the Forward path then I'm able to render both cameras OK, but then the lighting on the player's gun doesn't match the lighting on the environment properly.
     
  6. Rodmanix

    Rodmanix

    Joined:
    Dec 4, 2012
    Posts:
    14
    Bump... Did anyone find a solution for this?
     
  7. Diet-Chugg

    Diet-Chugg

    Joined:
    Jul 4, 2012
    Posts:
    51
    I have not been able to find a solution either. Any one else been successful?
     
  8. Simon-O

    Simon-O

    Joined:
    Jan 22, 2014
    Posts:
    50
    Another person with the same issue here.

    I'm using a 2nd camera to generate a 3D skybox (similar to how the source engine does it). By having a mini-terrain, with a 2nd camera slaved to the first (but moving much less), I get semi-distant objects who move correctly but are comparatively low-res.

    Works perfectly when forward-rendered but fails with deferred.
     
  9. SeruK

    SeruK

    Joined:
    Sep 22, 2016
    Posts:
    12
    To resurrect an ancient thread (but since I ran into this issue and Google took me here): Aras provided the answer in 2010, but failed to mention one caveat. layerCullDistances can only be used to lower the far clip distance for a specific layer, not set it to higher. I.e. the solution is simply to do the inverse: set the camera far clip high, then write your real far clip into all layers that are not the layer you want to render at a further distance.