Search Issue Tracker

By Design

Votes

3

Found in [Package]

3.3.0

Issue ID

1074604

Regression

No

Black background when using Camera Clear flag: Depth Only in LWRP only

Package: Scriptable Render Pipeline Lightweight

-

How to reproduce:
1. Open the user-submitted project
2. Open the "Main" Scene
3. In the Hierarchy window select the "CameraDrawer" object and set the Camera Clear flag to "Depth Only"
4. Observe the Game View

Expected result: the "CameraDrawer" renders the depth of the top cube as with the "Main Camera"s skybox in the background
Actual result: the "CameraDrawer" background is completely dark

Reproduced in: 3.3.0; 3.0.0; 2.0.8; 2.0.1

-------------

  1. Resolution Note:

    Thanks for raising this issue. This is something we are documenting now, but I will give you a rundown of how thing work in SRP, the reason things work this way, and how to achieve what you want in your project.

    One of the biggest issue we have in the older rendering pipelines in Unity is to do with camera layering (or stacking as we normally call it). The issue here is that there isn't a good way to stack cameras that makes sense, and we still have a lot of bugs that lead to very weird corner cases in our rendering. In the SRP's we provide we made a decision to not allow camera stacking. What this means is that each viewport is considered a separate logical view of the screen. It will do it's own culling, rendering, and then copying to the final framebuffer. We feel that it's a safe decision to make as with SRPS's you can modify the behavior to get specific things to happen for your specific case if you need to.

    In the case you have raised, to achieve what you want this is what you should do:

    1) Render the 'overlay' first to a render texture of the correct size. Use alpha to set the areas where it should be transparent. You can use the camera as it is now for this.
    2) Render the 'normal' game scene as you normally would.
    3) Write a custom post process (https://github.com/Unity-Technologies/PostProcessing/wiki/Writing-Custom-Effects)
    4) Have this post process effect alpha blend your custom overalay at the right point in the post stack.

    Alternitively:
    1) Render the 'normal' game scene as you normally would.
    2) On your second camera add a custom LW REnderer (https://github.com/Unity-Technologies/ScriptableRenderPipeline/blob/master/com.unity.testing.srp.lightweight/Tests/Scenes/045_CustomLWPipe/CustomLWPipe.cs)
    3) Have this renderer (in the last step), alpha blend the result to the screen instead of just copying.

Comments (19)

  1. chrysu76

    Nov 04, 2020 03:52

    Who idea was this?

  2. supermeip

    Oct 21, 2020 23:59

    How is this resolved? That's even more ridiculous... this literally makes a whole type of camera and canvas useless going forward!

    Like it is literally broken and DOES NOT WORK how is this resolved?????

  3. supermeip

    Oct 21, 2020 23:56

    Wow thats absoultely absurd. This is a REQUIRED feature for game design, I can't think of a single game that exists where you won't need to hack this fake feature to re-create the game... I'm absolutely stunned by this oversight and after years of programming in unity may need to switch to Unreal because of JUST THIS but it's literally a required gosh darned game design feature... like HOW?

    Absolute joke, I honestly couldn't believe this at first... wow, unity is no longer easy to use.

  4. altergaze

    Nov 25, 2019 18:57

    +1 on the "this is absurd and needs to be addressed". Obviously, you can hack it to make it do what you want, but it's a pretty basic request to have this option naively.

  5. Alejandro-Martinez-Chacin

    Aug 12, 2019 18:07

    Any news on this?
    https://github.com/Unity-Technologies/ScriptableRenderPipeline/blob/master/com.unity.testing.srp.lightweight/Tests/Scenes/045_CustomLWPipe/CustomLWPipe.cs
    This link is still down, what's the way to find/handle or use those functions?

    Regarding manually mixing layers on our own:
    One thing to take into account, when mixing one element on top of another, including UI (UI in camera mode doesn't work out of the box) the right blending to use is to be premultiplied alpha blending. That means starting on a black color and alpha-zero canvas and start overlaying elements on top, where the RGB blends as premultiplied alpha blending and the alpha gets added up. This final result can then be correctly blended on top of what was behind.
    Does Unity's UI shaders handle it this way already? On the texture side it doesn't seem like it (and some import settings actually unmultiply) but may completely apply the alpha premultiplication at the shader level.
    Would be great to have an example of this working for ease of starting a set up project.

  6. GubaLord

    Aug 05, 2019 09:13

    ByDesign is the coward synonyn of we can't did it.

  7. viruseg

    Jul 27, 2019 04:47

    I can not believe that this is true. One camera for everything. This is the worst thing you could think of.

  8. Kronnect

    Jun 14, 2019 15:47

    Absolutely complex solution. Unity needs to get back to the blackboard and address why things that were working are now completely broken by design decisions.
    In any case, it's ok to have to rewrite stuff but the given solution is over-engineered and not designed at all from an end-user perspective.
    Seriously, Unity is at risk of losing an important amount of user base due to the extremely complicated turn of things SRP is bringing to the table. Is Unity going to be an AAA engine for AAA developers?

  9. Tona999

    May 25, 2019 14:50

    This is absurd. If there is a way to do it as you say, please do it and keep it compatible with the older versions.

  10. JamesL98

    May 17, 2019 06:10

    This is an absurdly bad move by unity to make it simply not available in srp especially when the HD and lw pipelines are still in development and a majority of third party assets don't support it. Why remove it at all in the srp, it was working fine beforehand and it's a super super useful ability.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.