Object masking

I am trying to have parts of an object disappear when it moves behind another object (partly transparent)

Sort of like walking behind glass and suddenly not being visible.

Thing is - I need the background to remain ‘alive’ and visible with stuff moving around. So I need to mask out ONLY parts of this single object… Does this sound do’able to anyone?

BTW: Blender 2.82 and Cycles

Thanks in advance

…EDIT (days later)
Maybe I need to give up hope. For now I have to render background seperately and use a plane with holdout (shader) behind my ‘glass’. And it makes the work flow much less intuitive and using render view becomes very confusing when things that shouldn’t disappear… disappears.
Keeping hope alive :slight_smile:

Perhaps use a mix shader to mix between the original shader and a transparent shader and use the object coordinates of another (empty) object to control the mixing? Or use a gradient texture the same way plugged into the alpha of a regular shader


any part of the object that is to the right of the [+] icon “Empty” object becomes transparent. You can move the object or the Empty to move which part becomes transparent.

Thanks @thinsoldier

That is actually pretty cool. But not what I was aiming for. I think I should post a picture of what I have (and point out what I am missing).

On the plus-side: I made a (very annoying) work around with 2 renders that I could merge in video-edit. So now my request is a matter of curiosity - and perhaps one day I’ll get the time to revisit. I would really love to be able to do this in one render!