Mixing Deferred Lighting and Forward rendering paths

Unsatisfied with both Deferred Lighting (since it has no anti-aliasing) and Forward rendering (which can only support a limited number of lights), I am trying to use two cameras: one for the bulk of my many-light-lit background scenery (Deferred Lighting), and then a second camera for my lots-of-sharp-edges foreground items (Forward rendering, anti-aliased).

This works as-expected if the second (Forward) camera has Clear Flags of Depth Only, but of course the foreground objects do not go behind anything in the scenery.

But if I set the second (Forward) camera Clear Flags to Don’t Clear, it’s as if the depth buffer is never cleared. i.e. as if Deferred Rendering does not clear the depth buffer, or is using a different depth buffer.

To “solve” this, I added a third camera, rendered before the other two that just paints to the depth buffer. This works, but seems rather overkill (I’ll only be enabling this at quality levels Beautiful and Fantastic).

Has anyone had any better luck mixing the two rendering paths to get the best of both worlds?

While not really an “answer”, I have found that the performance loss and the loss of shadows by using two cameras (three, thanks to the depth buffer problem) is not worth it just to get AA.

Instead, I am using, and recommend, using FXAA in Unity to get AA in Deferred Rendering.

You have discovered an excellent solution, but it does lack shadows. If only Unity supported deffered lighting rendering, rather than just deffered rendering, then you could add all the MSAA you wanted. I do hear there are some Anti Aliasing compatibility bits you could use to force SGSSAA to take care of vegetation jaggies, this combined with SSAA image effect would eliminate most Jaggies, but would still not look as good as traditional 8xMSAA.