- Home /
Camera layering : UI shader is cleared by second camera with Depth Only flag
Hello everyone,
I've searched for hours for a solution, I really hope some shader-cultured programmer can help me!
I have 2 cameras :
Main camera with most layers, basically the playable world. Clear flags = Skybox, Depth = -1
One rendering ONLY the Lucid layer (black cube in 2nd screenshot), which has to render on top of everyhting so Clear flags = Only Depth, Depth = 20
The problem is that on Camera 1, all the UI canvases in World Space in my Default layer are getting cleared by the second camera! I guess the problem lies in the UI default shaders. Even if I make the 2nd camera as Don't Clear, it clears out all UIs...
I thought about editing the Default UI shader and play with rendering Queue, clear flags in the code, but I can't even find where it is or how to edit it.
What might help is that on the 2nd Camera, there is 4 Command buffer, and removing "BeforeImageEffects: Post-Processing" puts back the UIs, but makes the wanted object disappear...
Here are two screenshots demonstrating the problem :
First image shows only the Main Camera, with all the world space canvas UI's showing correctly.
Second one is with the black cube on the Lucid layer, in Camera 2 : all canvases disappear...
I'd be very grateful if you could help me out ! Cheers
Also : I tried creating a 3rd camera for all UI but it doesn't solve the problem : the "Lucid" layer with Only Depth flag clears it out, and vice versa.
Answer by spuchals · Feb 11, 2021 at 03:20 PM
I found a "solution", this seems to be a bug with Post-process Layer component !
Unticking "Directly to camera target" in Post-process Layer solves the issue, but might leave other consequences...
Also, I'm working with Aura 2 and this issue seems to have broken it. I'll rebuild the camera from zero and see what happens...