Yes, but this is a post process effect so you will not see the inside of the cube to which you apply the mask because the mask is being applied to pixel data, not to scene geometry… Here is a screen shot of one node setup that will get the job done. There are other ways to do it also, even more so in the CVS builds, though I haven’t worked that out yet.
Note that each object is on it’s own render layer. This process is much less difficult to understand if you use an image file to mask the geometry rather than trying to use scene geometry to do it. This is because you can not simply use the alpha channel from one render layer to mask another as you can with an image file. You must first invert the alpha of the layer that you want to use as a mask and then multiply the alpha of the layer to be masked by the previously mentioned inverted alpha. The color ramp has been inverted from it’s default value and is used to invert the alpha channel of the layer which you want to apply as a mask.
If you have trouble understamding all of this, don’t worry, you’re not alone (I’m probably not explaining it very well either). I don’t do this very often and I have to play with it for about 10 minutes every time. You can always prebuild these effects, group the nodes together with a name and save them to a library from which you can later append, but that will just ensure that you never understand what’s going on which in turn will severly limit your ability to create. If you want to build a library like this, use it for studdy only and then rebuild the effects by hand until you begin to comprehend what’s really going on.
Here’s the blend file from the screen shot:
If yyou just want to do this to apply over another image or movie then you won’t need render layer #3 or the alpha over node. Your rendered file will have an embeded alpha if you set it up via the combined button on the render layers tab and the RGBA button on the format tab.