Material Editor: Generate mask from color ID texture I'm trying to work out a way to generate a mask based on a color ID texture in the material editor (not the compositor). What I'm trying to achieve is have a node group I can re-use which has two parameters, the first parameter is the color ID texture and the second parameter is the color from the texture I want to generate a mask from.

I've included an illustration:


I got it working for some colors (such as red, green, or blue) but it didn't work in all cases, I also had a problem where the mask would show up properly when previewing it through an emissive shader but wouldn't show up when viewed through a normal diffuse shader.

Thank you for your time.
Two independent node groups for creating a mask based on a color and a texture :

material setup :



the first node group outputs boolean 1/0  ( all comparisions are "less than "):



the second node group outputs grayscale :



adjust the sensitivity/clipping to get a good result "sensitivity is added to overcome  errors due to rounding the numbers"