3
$\begingroup$

I want to change the color of two Materials with one group node.

That's my setup:


First material (Car paint)

just a Glossy BSDF for the color inside a group.

enter image description here

Second material (Black strips - mask)

A Black & White mask in the fac of the mix shader. In the mix shader the Color group from first material and a glossy BSDF to change the strip color.

enter image description here

I assigned the first material (Car paint) to those parts where I don't want the strips to be.

enter image description here


My issue

And my problem is that the color I change on the input of that group don't sync with each other:

enter image description here

enter image description here

Only when go inside the group and disconnect the inputs and change the color there it is working. But then I'm not able to change the color on the right side in the materials tab inside the properties window.

enter image description here

It is not quite that of a problem but I just don't understand why the group inputs don't sync with each other like when I'm inside the group. What makes changing the Color for both materials at same time impossible in side the properties window in the materials tab. Maybe my setup is just wrong for the kind of result I'm looking for.

So my question is why the Group Inputs don't sync with each other? And would there be a other way to achieve the result I'm looking for?

$\endgroup$
1
  • 2
    $\begingroup$ Hi :). This is intentional - so you can reuse one nodegroup with different values in multiple materials. You can use another nodegroup/custom property/object color to drive color for all groups at once :)) $\endgroup$ Commented May 15, 2022 at 14:29

3 Answers 3

5
$\begingroup$

Node Group (Color Sync) - to changing color in all instances - open node group and change color inside the group. It is designed in that way and that is how you benefit from it ... so you are using it correctly.

Changing color outside (on income socket) of node group sets color just for specific instance (node group).


Version Strips Color Ramp - here another option to create strips for a single material :)
Upper ColorRamp masks strips on roof.
Lower ColorRamp are strips.

enter image description here Or you can mask strips on Z axis, that is even better to cut strips at bottom part :)

Version Strips Math ... to easier control strip setup (without Color Ramp), you can use something like this ... the upper three nodes are strips, the lower three nodes are strip mask (it prevent side strip repetition).

enter image description here

When closed into Node Group can be controlled by two values ...

enter image description here

$\endgroup$
3
  • $\begingroup$ I like this. but I noticed some weird shading in the material preview. There are like one extra strip a little bit brighter and if I swap the colors one of them becomes blue. In rendered view everything looks fine. here is a screenshot of what i mean: link $\endgroup$
    – ki_one
    Commented May 15, 2022 at 20:09
  • 1
    $\begingroup$ Hm ... I can't replicate your issue. Try to enable "Clamp" on Subtract node (inside the node group) ... or share a plane with your material to let us see. $\endgroup$
    – vklidu
    Commented May 16, 2022 at 7:24
  • 1
    $\begingroup$ I thought I tried that on every note. But that fixed the issue. Thanks! :) $\endgroup$
    – ki_one
    Commented May 16, 2022 at 8:26
2
$\begingroup$

You can create this effect a million times easier if you do something like this.

enter image description here

A wave texture can be used to create sine waves (basically infinite repeating stripes).

enter image description here

Compare node allows you to select a certain slice of those sine waves.

enter image description here

Then create a vertex color mask to subtract the parts we don't want from the stripe mask. If you select certain faces in edit mode, then click this button in Vertex Paint mode:

enter image description here

... it will allow you to fill (Shift+K) only the selected faces. Then Ctrl+I to invert, X to invert the color and fill with black.

enter image description here

Then subtract that from your stripe mask.

enter image description here

Then you use this as the Fac for your two shader colors and voila!

enter image description here

This way you can keep it all in one material. And the stripes are way more procedural and easy to modify, much better than that crazy setup you got right now.

$\endgroup$
0
2
$\begingroup$

To answer "why the Group Inputs don't sync with each other?": It is because each material has its own instance (copy) of the group, and each instance has its own unique input. That's how node groups are designed to work.

To answer "would there be a other way to achieve the result I'm looking for?": There are many. Jachym Michal suggested several in a comment on your question

use another nodegroup/custom property/object color to drive color for all groups at once

Jakemoyo suggested a different approach in this answer.

I'll describe the "another neodegroup" approach because it is closest to your workflow.

When you copy a nodegroup to a material, the inputs are unique, but the interior remains the same. So, create a second nodegroup that has no input, consists only of an RGB Input node, and outputs the value of that node:

Simple color group

Give that nodegroup a name, perhaps "Base Color".

Hook it to the Color input of your existing node group, in both materials. I didn't duplicate your setup, but here's an example using the node group directly as color input.

Simple material with nodegroup

Here's an example similar to the stripe material

Simple material with mixin

Note that I'm just plugging the new nodegroup directly into the color slots of the shaders, but you would plug it in to your existing nodegroup; not changing anything else.

Now, when you want to change the shared color, select either material, open the nodegroup, and change the color in the RGB Input.

$\endgroup$

You must log in to answer this question.

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