How to make objects between player and camera transparent?

I’m aware of the set visibility option, but I think that would be too extreme. I would like the player to be aware of the object’s presence and location but still be able to see through it if it is too close to the camera. There are so many possible materials. Setting all of them individually is just overkill.