Objects shows through other objects when compositing I'm trying to composite some lights using screening but while it looks fine head on, it shines through parts of my main object.  Sorry my node setup is large; hopefully you can see it better when you click on the image.

Here you can see what I mean as the lights go through the hose:



Here is my node setup:



Thanks!

EDIT:

I found the solution.  Not sure why this worked, but I just made the hose (and subsequently every other object on the first layer) a pass index of 1, and used an ID mask (with 0) directly from the first layer into the factor of the screen node.



Here's the updated render:
My example was made in Blender Render, but it doesn't matter in this case.
First of all enable Object Index pass in Render Passes tab, then give index 1 to your hose (note, that objects with same index will produce combined mask, and to keep them separate use different numbers).

Edit: Material index pass is usefull when your object can't be physically separated in parts, so apply different materials for these parts.

This is overall setup: