Search Unity

Problems with camera rendering order

Discussion in 'Image Effects' started by QuantumMaster, Jun 8, 2016.

  1. QuantumMaster

    QuantumMaster

    Joined:
    Jun 8, 2016
    Posts:
    4
    I've been working on this for awhile now and it seems there is a problem with the cameras.
    My goal is to get a working background image for the program I have created.

    My main camera:
    Layer = Default
    Depth = 0
    Clear flags = Depth only
    Culling mask = Everything except "UI" layer​
    Background camera
    Layer = Default
    Depth = -1
    Clear flags = Solid color
    Culling mask = "UI" layer
    The image I'm using is inside a canvas. The canvas and the image are in layer "UI."

    This should make the background camera render the picture behind the main camera, but it doesn't.
    Also, when I click either camera, neither show any UI elements in the camera preview window.

     
  2. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    Have you tried using the frame debugger to see whats happening? It's in the window menu and will show you exactly what is happening for each draw call. It will help diagnose the issue in more depth.

    http://docs.unity3d.com/Manual/FrameDebugger.html
     
  3. QuantumMaster

    QuantumMaster

    Joined:
    Jun 8, 2016
    Posts:
    4
    I just did, and it says that the canvas that contains the background is being rendered after the main camera.

    Here's the frame debugger after everything is rendered:
    upload_2016-6-9_9-27-40.png
     

    Attached Files:

  4. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    ahh

    Overlay canvas does not render via cameras, it goes direct do screen. You want to have a 'Screen Space - Camera' canvas.
     
    drhmiri likes this.
  5. QuantumMaster

    QuantumMaster

    Joined:
    Jun 8, 2016
    Posts:
    4
    Ok. It works now. Thanks for you help!