Mixing materials using textures in nodes I am doing a test for mixing three materials using black-and-white image in nodes. 

What I want basically is something like this - 



It is a cube object. And on the white portion the material colour is yellow and in black portion the material color is red and in blue portion the material color is Green. 

So what I did is I opened up GIMP and made two separate black-and-white image. Like these - 

Map1

 

Map2



And then set-up the nodes this way - 



But I am not getting the desired result. What is wrong with this? And how to fix it? 

Do we mix various materials this way for complex meshes and material mixing patterns? What is the best way to achieve this?

I am adding the blend file for further clarification:
You only need one difuse shader and the rest is combining colors using the existing masks. 

The result of one RGB mix is concatenated to another RGB mix and those become the color for the shader.



(Click on the images to expand to full screen)

If you must use shaders then the masks are used in a similar way to concatenate the mixes one over the other.