A part of an object to be translucent partly only

Hello!

I have a topdown camera, so sometimes some objects (even sometimes the player itself) are hidden behind some other elements - for example, brushes or satic meshes. What I want to do, is to make these objects which are hiding my ones partly translucent - only a part where the actual hidden object is, and not 100% translucent, but say 30% only. All of that at runtime.

It seems that there is two approaches - using a BLEND_mask or a BLEND_translucent materials. But it seems that I would need to use them somehow simultaneously to acheive that. Because I don’t want to make the whole object translucent (as with BLEND_translucent), only a small area of it, but I don’t want this area to be completely translucent, as with BLEND_mask. Have I missed something which could make a part of an item to be translucent?

You could make the material translucent and modify it’s Opacity value on per-pixel basis using some sort of mask rather than a constant for the whole mesh. This way you would get only part of that mesh transparent and to whatever degree you want (for example 30% transparent would be Opacity = 0.7f)

Can you give a little more information please?
How can I do something like that?

Here is a sample material:

And the result: