1
$\begingroup$

So I have a model that has two different shading versions. The usual principle bsdf and emission for a shadeless render. Using mixer nodes makes it easier to switch between the shaders in nodes but I still have to go through each material to update the mix node. Is there an easier way to switch shaders?

$\endgroup$
2
  • 1
    $\begingroup$ could you please show some screenshots? $\endgroup$
    – moonboots
    Commented Jan 26, 2021 at 17:09
  • $\begingroup$ @moonboots imgur.com/a/HqxvvE4 It's just one material with two shader nodes into a mixernode. Could I do this for several materials to quickly switch shaders without going through each material? Do I have to make a keyframe or something? $\endgroup$
    – Uwais
    Commented Jan 27, 2021 at 13:16

3 Answers 3

2
$\begingroup$

Add a driver to the Fac (mix factor) of the Mix Shader nodes. Use a Custom Property or the X-value of the position of another object to control the driver. If you change the value (0 or 1) then the driver(s) will update the Fac value for you and you can switch between all materials with a single click.

Example with Custom Property

  • create a new Customer Property. You can use any object like the camera or an Empty. I used Suzanne the monkey in this example because Custom Properties of an Empty are not displayed in the side-panel ("N-panel") of the viewport, just in the Object Properties panel under the Custom Properties section.
  • Enter 0 or 1 (no trailing .000) for the Property value and Default Value and give it a proper name ("Shadeless" in the example). If you change the name later you need to update all drivers manually.

new property values

  • Right-click the value of the new property and select "Copy as New Driver"

  • In the shading editor, right-click the Fac value of the Mix Shader node, select "Paste Driver"

  • repeat the last step and paste the driver in all materials that you want to switch

Finally, to switch it, select Suzanne and change the value of the custom property.

the switch in action

$\endgroup$
1
  • $\begingroup$ I tried yours because it was the most in depth of the three solutions and it worked like a charm. Although I was worried at first because when I tried to copy-paste the driver from the n-panel properties onto the mix node my blender 2.91.2.0 would always crash. But thankfully it worked from the object properties. Thank you so much, Blunder! i.imgur.com/yBph1Kg.gif $\endgroup$
    – Uwais
    Commented Jan 28, 2021 at 15:05
3
$\begingroup$

A bit dirty but you could use a node group:

Select the Mix Shader that you use as a shutter, press CtrlG to create a group. Once done, press Tab to go into the group and unplug the factor socket that will be created by default. If you play with the factor value it will switch from a shader to another:

enter image description here

Press Tab again to go out. In all your other materials create the group you've created with ShiftA and plug the shaders:

enter image description here

Now select one of these groups and play with the Mix Shader factor value, it will switch all the other material Mix Shaders as well.

$\endgroup$
2
  • $\begingroup$ why dirty? I think it is pretty clean, if you give the group node a good name like "color all nodes" or something ;) $\endgroup$
    – Chris
    Commented May 29, 2021 at 11:07
  • $\begingroup$ I don't remember, I guess I expected a more direct way to do it ;) $\endgroup$
    – moonboots
    Commented May 29, 2021 at 11:47
2
$\begingroup$

If your model is one object..

You could use the Object tab > Relations panel > Pass Index, or some function of it, as a switch. It's called 'Object Index' in the Object Info node:

enter image description here

$\endgroup$

You must log in to answer this question.

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