Using an object as a clipping mask for another object I want to use an object as a clipping mask for another object. So that the sound waves take on that wedge shape and can be animated as moving through the wedge shape, but of course you don't see the wedge, only the red sound waves.



I need this to be a node setup, probably with ID Masks, Object passes, etc. and not with a boolean modifier as those are unpredictable.

I've done a lot of research and gotten very close but still can't quite figure it out!
With a scene set up like your image, a wedge shape and the curve shape with an array modifier; I created the mask with the compositor.

I have a fully transparent material on the wedge, and the material pass set to 1 (object index pass would work here as well.) Do note that the wedge's top face has to be above the curve shape for the IndexOB or the IndexMA to give a usable mask.

In the compositor use the material, or object index pass as a mask by multiplying (a Mix node) it with the image's alpha (because the material index pass is set to one there is no need for a Id Mask node). Then take the black and white masked image from the mix node and use it as the image's alpha with a Set Alpha node.


Here is the result after using the IndexOB as a mask.