How do you make an xray material (or similar) I's there a way to make a material such that when viewed through another object it appears differently?

Example:
object 1 is a black sphere
Object 2 is a glass plane

When viewing the black sphere through the glass pane the sphere becomes translucent, or in some way changes the texture that is visible THROUGH object 2, but anywhere that object 1 is directly visible to the camera it remains a black sphere.

Is this even possible using standard blender tools or will this require scripting and mods?
There are several ways to approach this, the most flexible is likely compositing and renderlayers. However, it is possible to do this from within cycles:



If the incoming ray has bounced more than once and it is coming from a transmissive object (such as glass), it will be translucent. Otherwise it will be diffuse.