I am making a node group for a procedural texture, and want to create a node that has a setting that defines which color value to use, and can be toggled. basically the exact same thing as the switch node, but that doesn't exist in cycles material editor. Is there a way to do this?


2 Answers 2


Use a MixRGB Node, then as the inputs add two color values each with your desired color.

Then for the mix factor 0.0 will be the top most input, and 1.0 will be the bottom most input.

Anything in between will be a "mix" of those two colors (but if you want it to be one or the other, just use 0.0 & 1.0).


  • 1
    $\begingroup$ @JoshSilveous Set it 1.0 the toggle by muting it (M) is another option. $\endgroup$
    – Leander
    Feb 28, 2017 at 17:14

I just so happen to have created a custom Group Node that does precisely this. I found myself in a similar situation as yourself, although I needed to switch between more than two sources, so I put this together.

In this demonstration there are 10 different colors being sent into the switch node for convenient testing. You can easily see how the material's color changes when you type the corresponding channel number.

10-channel switch group node

While I was at it I also created a 4-channel switch and a 2-channel switch (the 2-channel switch is admittedly redundant when you consider Rick Riggs' suggestion). You can pick whichever one suits you.

Inside the Group Node it looks like this:

The routing inside the 10-channel switch's group node

This routing uses the principle of a "band-pass filter" to allow only values within a specific range through. By chopping a color ramp into ten equal bands of 10% at different places in the spectrum and assigning each to an input channel, we get a handy switch selector.

  • $\begingroup$ Nice! Is there a way to use this shader on multiple objects and then change the channel for each object separately? For example ten picture frames using all the same shader but showing different images. $\endgroup$ Jul 17, 2019 at 10:47
  • $\begingroup$ Any property (shader, color data, etc) that you want to be shared between multiple materials should be encapsulated in a group that is instanced inside those materials. See this answer for details on that. The switch in my answer is doing something a little different, since the resulting output will depend on the slider value, and you don't need to change the contents of it. But knowing that any part of a node setup that has been grouped can be shared across materials, you can change the internal routing of a group to reroute all affected materials. $\endgroup$
    – Mentalist
    Jul 17, 2019 at 15:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .