Ok, this is not a specific problem and I guess it's not possible.
I were tinkering around and suddenly a thought hit me, is it possible to use an custom AOV, a white cutout of an object, as a mask in the shader network?
If it's possible some steps of comping could be avoided and strange stuff can be created 🙂
I found techniques to mask with transparency, but an AOV would add so much more possibilities.
Why dont you just render out the AOV as a sequence and bring it back in as a bitmap sequence? Either way, you can map it like you want, through the camera or on an object.
@Mads Drøschler of course that's sort of comping with a rendered sequence, but it's not as flexible. If you change the position of the masking object, and maybe also the camera movement, you need to render that first part all over again.
I ask this because it could be really practical to be able to plan even stuff that only would be solve with comping while you work. With masking you can combine, sort of, two scenes or more in one.
The fewer steps, faster result.
The data is there, would be fun to use it in unusual ways.