Classic usecase. Basically, when a ray hits an object, this special material property would "teleport" the ray to another location, render layer, or scene.
A simple UI would be to add a material output node with vectors "ray position" (or offset) and "ray direction" (or rotation), which represent to where the ray is transported after hitting the object. Obviously, this would only work in raytraced mode, and cannot work in paint rendering.
Currently, this can be achieved using texture baking, but that doesn't lend itself very well to ambient occlusion or animation.