I added a more advanced example.
(note the shadow of the pole leaning against the bike shed )
And when you render mip_matteshadow2.ma you get this:
However, those are both “in render” comped. What if you want to have all those nice lighting, reflections, etc, but you want to do the “real” comping in post?
Well, to do that you need to add a couple of tweaks.
First, you go into the mip_rayswitch_environment in your camera, and put “transparent black” into the background slot. Since Maya’s color swatches doesn’t have an alpha, you can connect the “mib_color_alpha” and turn it’s blend down to 0 to get the same result.
Secondly, in your mip_matteshadow, rather than using a mip_cameramap directly for the background color, we add another mip_rayswitch_environment. Again in it’s “background” slot we put in transparent black (i.e. mib_color_alpha), and in it’s “environment” slot, we put in the mip_cameramap we previously had stuck directly into mip_matteshadow.
The result is mip_matteshadow2b.mawhich renders like this:
…which has THIS alpha channel:
…which can be comped straight onto your background (interpret as premultiplied)!
Here is the .iff with alpha for anyone wanting to try it.