How to Give a Single Render Layer a Transparent Background/World

The title probably says it all (or at least most of it). How does one take a single render layer (one of several), and make any open parts of it (i.e. without objects) transparent? And this without using the “Transparent” setting in the “Film” section of the Render tab (which seems to give all render layers transparent backgrounds). This is to drop one render layer on top of another, without any mixing of the two, as the “Mix” compositing node will do.

This seems like it should be ridiculously simple, and yet I can’t figure it out.

I’m usually a bit lost when it comes to nodes, so I would probably do it the old way: create a separate scene, and composite them in the sequence editor. you can add scenes just like you add a movie or image strip or audio strip. you may have to change a couple of settings in the properties panel for the alpha, or maybe not. sometimes I get version confusion.

I think I get what you’re saying. If you just want the alpha channel to use as as the factor for the mix node, I’d just assign one pass index value on every object in your scene, and then use that value as the mix node factor.

Wouldn’t use indices. Not antialiased, difficult to work with later.
Unfortunately it seems that the only way is to use different scene.

Oh, sorry. I didn’t see you didn’t want to “mix” the channels with the mix node.

I’m not sure if this could help achieving your goal, but how about using “Transparent” in Film settings and activate “Environment” pass for all the layers that need it?
Yes, this requires some additional steps in compositing (adding ENV passes to all render layers), but this solution would make it possible to render everything in a single scene.

Yeah, that would work, unless the scenes have different world textures and/or colors, but if they did, I don’t see how you could combine them. Hopefully they would all be the same world material, and in that case, using the environment pass would work fine.

Well, it took a little fiddling around with the other nodes to get this to work, but that method seems to be sound. (For this one particular scene, anyway.)

Thanks for your help guys (or gals, whichever you may be).

Bartek and I are guys ;). I’m not sure about Modron though. Here is Bartek’s stuff on Blender Cookie:
http://cgcookie.com/blender/author/bartekskorupa/

actually thought of a super cool solution, you just create a plane to cover up the object you want without environment, and then set it to holdout on the view layer. disable it in other layers. This way, you can set the film transparency off, while getting no bg on another.
(That is if this is still valid and blender has no new settings for that XD)