Location based opacity but with a mesh as a shape instead of a simple sphere/box?

So what im trying to accomplish is a skeletal mesh that is fully invisible and it also hides everything that’s clips into it.

Practical task: i have a Character’s base body and a several clothes for him. Problem is that clothes are clipping a lot into body. [SPOILER]

[/SPOILER]

My solution to this would be to create something simmilar to “Location based opacity” tutorial link] but instead of a simple sphere i wan’t the shape to be defined by a special Clip mesh, which will hide any clipping geometry of Character’s body but not clothes.

Particularly i have no idea how do i get SphereMask equivalent for a custom mesh.

The problem is, location based opacity, and sphere masks in general, are based on distance fields, not meshes. You can bake distance fields for static meshes, but it seems you’re looking for something dynamic. Dynamically calculating a distance field for simple shapes is easy, but doing it with a mesh would require testing against all of its vertices.

I think your best option is something like pixel depth offset. Just push the depth of the clothes forward, or the body backwards a bit. If needed, use a texture, or vertex colors specify the regions to apply it.