Search Unity

Question Unity 2021 does not allow to have 2D and 3D camera stacking anymore?

Discussion in 'Universal Render Pipeline' started by ATLAS_GROUP, Apr 20, 2023.

  1. ATLAS_GROUP

    ATLAS_GROUP

    Joined:
    Jul 15, 2021
    Posts:
    2
    Hello! Sorry if someone already wrote about this, but I did not find this specific issue I have.

    I had a project in Unity 20219.4.19f1 where I could use two cameras simultaneously, one for the 2D renderer (so I could use the 2D lights) and one for the URP renderer, for rendering 3D objects in front of 2D objects (and with post-processing and 3D lights on it).

    Then, with a bunch of new features ahead, we decided to go for 2021.3.21f, but now we cannot do that 3D thing anymore, as Unity shows the message "camera stack does not support cameras with different render types".

    One solution I found is just using the URP renderer, and using 3D lights on the 2D sprites, but this will bring a lot of reworking that I would want to avoid if it's possible... And I don't know if 3D lights are heavier than 2D ones.

    So, does anyone have an idea about some workaround, or there is something I missed? Why would Unity, being such a flexible engine as it is, cut off this awesome feature?

    One more thing, if my only way out it's working with the 3D lights, how can I change the exponential light range decay to linear, to look like 2D lighting again?

    Thanks in advance
     
    Last edited: Apr 20, 2023
  2. JulianRice

    JulianRice

    Joined:
    Oct 5, 2017
    Posts:
    13
    Bump on this. We had a similar degradation take place when updating from 2019 to 2021.
    So far, we've managed to find our way around 70% of the things that stopped showing/working/being lit properly. But there's still that 30% that's been stuck in this kind of limbo state over the last few months.

    I've been peeking at the some of the closed camera stack-related PRs on GitHub but haven't found anything specific just yet.
    https://github.com/Unity-Technologies/Graphics/pulls?page=2&q=is:pr+camera+stack+is:closed
     
  3. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    Can confirm. The documentation for the very latest URP still says:
    So... Is this a regression or a change?
     
  4. ATLAS_GROUP

    ATLAS_GROUP

    Joined:
    Jul 15, 2021
    Posts:
    2
    Wow, I checked the documentation you send and even for URP version 2021.3+ (12.1.11) it says the same thing

    But actually, it does not allow camera stacking between 2D and 3D renderers, and I'm not even talking about mixing 2D and 3D lights...

    I just want 2D lights affecting 2D and 3D lights affecting 3D, but I want both in the same scene (which seems like it should be possible)

    Is there any Unity support to clarify this?
     
  5. paulg5682

    paulg5682

    Joined:
    Feb 14, 2016
    Posts:
    11
    I am trying to get 3d lights in my 2d scene to affect 3d objects.

    I have tried camera stacking but you cannot stack a universal renderer camera on top of a 2d renderer camera. How can I achieve this?
     
  6. kayroice

    kayroice

    Joined:
    Feb 7, 2017
    Posts:
    49
    This may not fit your use case, but you can use a RenderTexture along with a Camera that uses URP's ForwardRenderer to add objects that use a 3D light to a scene that is being projected using 2DRenderer Cameras.

    In my use case I have stacked Cameras that display the scene using the 2DRenderer. I also have a couple 3D objects that I would like to have lit (using 3D lights). What I do to add those objects to the scene is to create a tertiary Camera that uses the ForwardRenderer, and move it in front of the 3D objects. Then I create a RenderTexture, and corresponding Material explicitly for the ForwardRenderer Camera. I can then move the material into the scene, and it will display the 3D objects and the appropriate 3D lighting. Details on how to go about creating the RenderTexture and applying it to a Camera can be found here: Render a camera's output to a Render Texture.
     
    JulianRice likes this.