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. Shudrum

    May 01, 2019 17:23

    This is just a joke. The ease of use of Unity is dead.

  2. Alejandro-Martinez-Chacin

    Apr 16, 2019 19:10

    Any luck on this? I tried and the CustomLWPipe.cs file and it doesn't compile. There are many classes and types that don't exist. It doesn't offer any insight of which libraries to include to find them either.
    The IRendererSetup type throws an error which is right there at the very beginning : public class CustomLWPipe : MonoBehaviour, IRendererSetup { ... }
    Any workarounds for this?

  3. ll3v3ll

    Apr 16, 2019 18:06

    Found the example for the Custom LW Pipe referenced above.

    Seems that the last incarnation of the codebase was in 4.x, and removed in 5.x+.

    [How: I browsed the different versions of the ScreiptableRenderPipeline repository (by tag) until I found one with the directory structure and file referenced.]

    https://github.com/Unity-Technologies/ScriptableRenderPipeline/tree/4.9.0-preview/com.unity.testing.srp.lightweight/Tests/Scenes/045_CustomLWPipe

  4. sebastiansgames

    Apr 05, 2019 06:36

    Wait— are you guys serious? LWRP only works with one camera and doesn’t have default depth clearing?? That is insane and makes it mostly useless. This should be underlined in bold at the top of all LWRP documentation. Frustrating and absurd beyond belief.

  5. SydonX3

    Mar 24, 2019 21:14

    The last link (CustomLWPipe.cs) is offline.

    Also: The simplicity of the legacy tool was great, I hope this will be implemented again in a way that entry-level developers can use it again.

  6. Ansum11

    Mar 01, 2019 18:45

    Hey, i had a similar issue with my current setup. Basically I am trying to set up a scene in LWRP VR where everything is the same monotone as the background, expect for certain selected objects. I thought i could do this by creating two cameras, but after a few tests i found out that the "Clear flags" tag was not working the way I had hoped. Is there an alternative way to pursue this, or is there a chance that this will be addressed in the next update?

  7. dandepeched

    Feb 26, 2019 20:39

    One more alternative - Do not use LWRP for anything more complex than 1 camera, it just do not worse it...
    After all the pain over past year that my project had because I believed in LWRP, I'm now happy to move back to Standard shaders which do not have any cons against LWRP.

  8. Azim-Palmer

    Sep 18, 2018 16:27

    A camera with fullscreen viewport rect works on PC, but I get the same black screen issue when building to an Android device (Pixel 2).

  9. dandepeched

    Sep 03, 2018 06:26

    In my experience this happens for the camera with non-standard viewport rect. Reported issue (1076621) is marked as duplicate of this one.

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.