# How to switch between node groups without moving noodles?

So, what I want to do is use a drop-down menu (or something similar) to quickly switch between the shader node groups I'm using in a material. The solution I have now is just swapping which node group connects to the material output, but I plan on releasing this to some people and I want it to be easy as possible to change what shader is being used. The best solution I can think of is a drop-down menu that someone can just drop down and select the one they want to use, but I'm not sure how to do that or if it's even possible.

• Group nodes are literally just that, why don't you use the drop-down menu of one unique Group node ? Feb 3, 2022 at 0:07

You can configure it like this. Use the Greater than function of a Math Node as a mix factor between your node groups (I used image textures in my example for convenience but it will work the same). Use a value node - you can enter numbers from 1- 4 in the Value socket to select whichever group you want.

• great minds thinking alike ;) except your tree is simpler. Feb 2, 2022 at 23:54
• Indeed. I was working on his repeat question when it got closed... then I found this one. Feb 2, 2022 at 23:55
• It just dawned on me that we use the same number of nodes, but with different fanout. I don't know why I thought you were using fewer. Feb 3, 2022 at 0:43

There are several ways to do this. Here's one that's easy to explain:

In this example four principled shaders stand in four your four node groups.

3 mix shaders form the switch. From left to right:

• The first mix shader selects between the black and white shaders.
• The second mix shader selects between the red and green shaders.
• The third mix shader selects between the other two mix shaders.

A value node and 3 compare nodes form the control for the switch. The compare nodes arrange to have a 0 or 1 value sent to the factor of each mix shader, effectively turning them into a switch.

The order of tests select the shaders as the value ranges from 0 to 4.

Another solution is to add a single material output for each nodegroup, and click on the material output you want displayed.

Okay, I just stumbled across this question now, but obviously the way to do it we all have in common. I used one node less because I switch between 0-3 instead of 1-4, but anyway. This answer is not to be understood as being better than the others. It was just that the question states it should be something where people don't have to do much with nodes that I came up with a driver-based version.

So I created a custom property on the object set to Integer and copied it as a new driver and pasted it into the input value (which is a group input in my example, I've hidden all optional shaders to switch between in a new group). I've used Integer since your starting with reconnecting nodes, so I figured you don't want/need no gradual transition between the different shaders.

Instead of using Greater Than or Less Than I used Subtract with Clamp enabled.

If you don't want to use a driver and prefer entering a value in the Node Editor, then the Less Than or Greater Than solutions might be better or maybe combining with Round, Floor or Ceil math nodes, since the Value node and the Group Input only use floats, not integers (and as I said before, I figured you don't want a transition between shaders).

This is the outside appearance of my version, you can enter 0, 1, 2 or 3 in the custom property switch to choose one of the 4 shaders in the group.

And this is how it looks on the inside. If you set switch to 0, the first Mix Shader takes the yellow color, all subsequent Subtract nodes will turn to 0 as well since they are clamped. A value of 1 will choose blue, the next subtractions both turn to 0. For 2 and 3 there is no need subtracting before the first Mix Shader, because values > 1 will be treated as 1. So in the second Subtract node I subtract 2, so that an input of 2 results in green and 3 switches to the last color red.