Unity 5.6 - Possible to disable camera shared render target?

Upgraded my project to 5.6, and I now seem to have cameras that don’t respect the depth buffer. This seems to be caused by the following change in the release notes:

Graphics: Refactored camera render ordering code. When a Scene is rendered, it now figures out which cameras can share the same render target. The rules for this are:

  • Cameras must use the same display to share the same render target.
  • Cameras must share the same viewport.
  • All cameras must have a depth buffer, or none of them must have a depth buffer.
  • If the Scene is being viewed in VR, the cameras implicitly share the same render target.

These cameras are then split into a stack, which is rendered into a shared Texture based on depth ordering. This Texture has the most common settings found in the cameras in the stack.

My problem is that I have:

  • A full-screen camera for background UI elements. (Depth 1)
  • A split-screen camera for mid-ground 3D objects. (Depth 2)
  • A full-screen camera for foreground UI elements. (Depth 3)

Unity detects that camera 1 and camera 3 share the same viewport, and render them together. Camera 2 is then rendered on top of Camera 3, despite Camera 3 having a larger depth buffer.

My current solution is to change the viewport width of Camera 3 from “1” to “1.1”, to prevent it sharing the same render target as Camera 1. It solves my problem, but it seems like a flawed workaround. Is there a setting I’m missing?

Was wondering how you are getting on with this issue? Seeing similar problems.

No fix unfortunately. Just using the workaround of changing the viewport dimensions.

Issue updated hopefully fixed soon Unity Issue Tracker - Camera Depth is ignored when setting both cameras Viewport other than (0;0;1;1)

I think I have got a similar issue and I think it is related with this. It is happening in Unity 2017.1.b5 and also 5.6.1.

The point is that besides the viewport problem there is a problem with the postprocess effect attached to each camera. So when the postprocess components are enabled everything gets broken, it seems a zfighting problem in which the models of my 3rd camera in the ordering are not being rendered because some postprocessing is attached to a previous camera.

So I cannot for instance apply a dof effect only to the scene and not to the player models, I can only apply the effect in the last camera.

I cannot understand how Unity has this radical changes and cannot understand why the camera render ordering is something that needs to be touched.