Location Based Opacity with intersection filler

Hi, everyone!
I’ve managed to reproduce [this tutorial][1].
But (because my knowledge of shaders is very poor) I can’t get the result what I want.

How it is now:

What I want:

How can I achieve it?