Trying to translate masked particle effect technique from unity to unreal

Check out this cool particle effect technique

It uses a particle system as a mask for other objects creating some interesting effects, I want to try to do the same in unreal engine.

As far a particle dynamics go I have no problem, the problem is the shaders, how do I set up a material to mask pixels drawn behind it (Mask Shader) on objects that use certain material (Masked particle additive)?

Here’s another use case for it