I have been working on a project where I need to apply image masking that applies an effect like this:

Pic1: <https://i.stack.imgur.com/6zI2x.jpg>

Pic2: <https://i.stack.imgur.com/z7IVX.jpg>

Mask frame: <https://i.stack.imgur.com/3syEm.jpg>

Desired effect: <https://i.stack.imgur.com/t2kO5.jpg>

I got it to work by using OpacityMask however to do that I had to use some photoshop and edit my mask frame image. I need to apply this affect to multiple mask frames with different shapes therefore using photoshop to edit all of them seem troublesome. Moreover, the inside of the mask frame images arent all transparent either.

Is there any ideas you can give me to solve this issue without using any pre photoshoping each mask frame images. I tried to look into ShaderEffect but I could not really understand how I should use it for my purpose. Moreover I searched for a OpacityMask like effect but working only on part of the mask image which has a specific color/specific shaped area. However, I could not find any.