Fade out faces in a mesh?

I’m making a game where the player character may in some cases end up behind a mesh, what I"d like to do is create a sort of spotlight which fades out the faces blocking the view to the player.

Is this possible and if so how can I go about doing it?

Depends on what that mesh is. A couple of ideas:

  • Subdivide your mesh into parts and then set transparent shader to the parts that you want to fade-out
  • Write a special shader which sets alpha for each pixel based on a player distace from that pixel