How do you get pixels that are behind a mask?

Hello everyone, I was wondering if anyone here might be able to shed some light on my dilemma. I’m trying to get pixels that are:

  1. Behind a mask relative to the cameras view
  2. Aren’t occluded by itself (Forward facing areas)

Any idea how to go about this? Thank you in advance.