How to make smooth edge of box with materials?
Why not do this with textures?

Simply make a black-and-white image texture, and use it to switch between two different material node layouts. It'll be better for performance as well, because there's fewer faces.