Set Material ID by Angle to Multiple Points

I need a script modifier that will change in real time the Material ID of the polygons, depending on which of the objects in the scene their normal is directed to.