Cycles - Compositor Rendering Nodes (black sections where objects intersect)

Hello. I’ve been trying recently to wrap my head around the compositor. I usually post-process in Ps but am seeking to learn the built-in one as well in order to further streamline my workflow. I have scoured the forums and watched several vid-tuts but am obviously missing something. Anyway . . .

I am running into the problem where my render includes black sections (the area where my objects intersect). The first attached screen is my basic render. The second shows my compositing nodes viewer.

I appreciate any help! Thanks!!

Here’s the very basic blend file also. (Hopefully this attaches properly.)
comp_test_020614w.blend (590 KB)

Again, I certainly appreciate any wisdom you could offer.

As always there are several options:

  1. In Render Layer settings of let’s say “render blue” - select layer 2 as mask layer. This will get rid of the black part of blue cube and your compositing setup will work fine.

  2. Leave Render Settings as you have them now, but in compositing try to use “Z-Combine” node instead of “Alpha Over”:

@Bartek - I greatly appreciate your help! I was able to get 95%-pleasing results as you described above. However, I am getting a really fine black edge that runs along the area where the two cubes meet. I played around with the antialiasing check boxes but it didn’t make that much difference. Do you have suggestions for getting rid of that really fine edge? (The alpha appears to be showing up from the underneath layer. It’s so minor that it may not be noticeable but I can see it and it bugs me. Ha!!)

The attached image references what I’m referring to. Again, thank you for your help!

Well, I didn’t say it’s perfect. Unfortunately the Z-Pass is not antialiased and the “Anti-Alias Z” doesn’t really antialias. It just blurs the edges a bit, but it’s not the same.
And no, I don’t think you are too crazy about details. Maybe because I also pay attention to such “small” imperfections.

I found some workaround, but it works only when we use mask layers in Render Layer Settings. It’s rather dirty solution, but it does the job in this case
Let the image do the talking:

Indeed the Z pass of the render passes is not antialiased but even when you use a AA zpass (you can make your own material override with z output connected to an emission shader), you still have this problem (less but still). The tip gave you Bartek is what I’m also doing on the animated films I’m working on. It is not perfect, but it does the job in most of the cases.

When I still have a strong black line, I increase the render size and I downscale it after compositing. It works really well but of course, render time is taking much more time.

Thank you both for the replies! This is very helpful. I appreciate your time and feedback. I will continue to investigate this at the earliest time, using your attack strategies. THANKS!!