I've just checked out the new UE4 (Unreal Eninge 4) and its material editor and I'm thinking how it works.
Is a new shader compiled for each material? If yes, isn't the lots of shader switches affecting the performance? How can it be optimized?
According to this paper, the material is compiled into shader code.
This node graph specifies inputs (textures, constants), operations, and outputs, which are compiled into shader code