One node group input override another I have a procedural texture node group that is being commonly used by a lot of materials as part of a global shader setup for a project. For a few objects in the scene, I want to use a image texture instead. It would be convenient for my setup if an object defaulted to using the procedural textures in the group unless another texture was plugged into the group. In that case, I need it to use that new texture and ignore the procedurals.

This could be accomplished by adding a mix node between the two, and giving the Fac as a group input. But is there a way to automate this? It seems it should be possible with some sort of math that controls the mix Fac based on the texture input itself. If the input was Black by default, then math with Greater Than could be used to set the mix fac to 1 if the input is anything other than solid black. But then if the new input texture has solid black pixels, I'd still get the procedural texture on those pixels.

Is there a better way?
You can do this by filtering on the Pink colour the Image Texture node outputs when no image is loaded. The only caveat is that it won't fully work if your Texture Image contains any pixels with RGB values of (1.0/0.0/1.0).



I've bundled the switching logic into a node for ease of viewing. Here's what the interior of the node group looks like:




Handling 2 Procedural Textures

In order to handle 1 or 2 procedural textures, you can set the default Colour on the Switch node to the Pink colour (R1/G0/B1). This way if nothing is connected it uses the default texture, and if the 2nd procedural texture is connected it uses that.



Blend file attached: