UnityFx.Outline icon indicating copy to clipboard operation
UnityFx.Outline copied to clipboard

Black screen when rendering with two cameras and depth testing

Open mihakrajnc opened this issue 2 years ago • 4 comments

I'm using URP, and two cameras (in a stack, second one is set to overlay). First camera is the one that has the objects where the outline shuld be drawn. The OutlineFeature is set up with Use Layer Mask and Enable Depth Testing. My Render Pass Event is set to After Rendering.

With this setup, my screen is rendered black. If I disable Enable Depth Testing, it renders fine (including the outline).

If I set the Render Pass Event to After Rendering Pre Passes, it also renders fine, but when the objects move the outline jumps around / looks glitchy.

Any ideas? Not sure if I'm doing something wrong.

Note: I could solve this issue by using two renderers in URP settings, having the second camera on a separate renderer, without the outline feature. But this adds quite a bit of overhead, especially on low end mobile devices, and isn't an option unfortunately :(

mihakrajnc avatar Dec 10 '21 15:12 mihakrajnc

Hey @mihakrajnc. I apologize for the delay with answer. Were you able to resolve the issue? If not, the first thing that comes to mind is something similar to #49. The fix for it is not released yet and visually it looks like you describe. What rendering API do you use (OpenGL/Vulcan etc.)?

Arvtesh avatar Jan 05 '22 16:01 Arvtesh

Hello! I wanted to ask if there was any progress on this fix, as I just ran into this issue today. Exact same situation as described above--I only run into problems when depth testing is enabled for an outline layer and I'm rendering to a camera stack. When that happens I see a black screen (see screenshot, the white shape of a bird in the bottom center of the screen is the object that's supposed to be outlined.)

I'm using Unity 2021.3.2f1, URP 12.1.6. I haven't changed any settings around the rendering API, so I'd assume I'm using the defaults there image

bsoglin avatar Feb 10 '23 23:02 bsoglin

Hey, I am very busy at the office and not sure when I will have time to look into this. So no ETA, sorry for this.

Arvtesh avatar Feb 11 '23 09:02 Arvtesh

Gotcha, no worries! By the way, thank you so much for this tool, it's really wonderful. It's saved me so much time

For anyone else who runs into this problem, I found that it can be worked around: this bug only occurs when you've got the outline effect attached to a camera that is rendering as an overlay. So if you use your outline effect camera as your "base" camera in the stack, this is not an issue

bsoglin avatar Feb 11 '23 18:02 bsoglin