In 2.77a Cycles Is It Possible To Render Two Layers With Z-Depth Information?

I have a scene with a camera moving around some objects, and I need to have some faint little particles floating about.

I am having no luck zeroing in on instructions for exactly what I am looking for. I want the object layer and the particle layer on different layers so that I can easily tweak blending options at composite time (either in AfterEffect or Blender’s compositor). However, I also need the particles to honor the objects in the scene, so that when an object moves in front of a particle, the particle is no longer visible.

I think it’s easiest to describe this in pictures. Is this possible in Blender without having to include the particles in the same scene?

I have tried copying instances of the scene geometry on the particle layer. This doesn’t work because I either need a light in the scene to light the particles, which lights those instances which I don’t want, or I have to make the particles themselves emissive, which causes light to cast on the instances sometimes as well, causing weird lighting artifacts at composite time.

Thanks, guys.

Attachments


Alright answered my own question.

Using the primary layer with all the objects in it as the layer mask for the particles layer got me what I wanted.

The following video really helped me understand render layers better: https://www.youtube.com/watch?v=6JHkkH6pLaw