How can I make an object only visible through certain material
It depends on your scene and what you need but you could use Light Paths node to make some condition that only one of your glass objects meet. For example you could have two glass planes, but one has another plane in front of it that has a transparent shader:



You can see the visibility of the orange shader is controlled by Light Paths node's transparency depth output that is 0 when we look through glass, but becomes 1 when there is a plane with transparent shader in front of that glass. You can see what happens if I move the transparent plane.