It looks that flow in my image wasn't self explanatory so here is modified one. And this one treats Material as ordinary node that also can be input one. Flow goes from right to left simply because that looks more logic to me. http://www.pasteall.org/pic/show.php?id=3220