3
$\begingroup$

I have the following model with two material slots assigned

enter image description here

Now I'm trying to duplicate the model and assign a different material to the duplication, but I get this result

enter image description here

It's ignoring the 'Set Material' node and is assigning the first texture slot to the initial geometry and the second slot to the geometry copy.

I want to keep the original model as it was and have control over each slot of the copy, could be possible to do something like that?

Here is the complete blend file to download

$\endgroup$
3
  • 1
    $\begingroup$ works for me :[1]: i.stack.imgur.com/cGee5.jpg what did u expect? maybe share your blend file so we know how your material (pbr) looks like? thx $\endgroup$
    – Chris
    Feb 6 at 13:27
  • $\begingroup$ As @Chris said, we don't know how your "pbr" material looks like - so without this knowledge it could be that the duplicate object is completely fine... in my answer I can show you how to change specific materials, but to examine your issue we might need your file. $\endgroup$ Feb 6 at 14:05
  • $\begingroup$ @Chris I just added a link to download the file in the post $\endgroup$ Feb 6 at 14:56

1 Answer 1

4
$\begingroup$

I'm not quite sure how you did this - is the inner white part masked (I'm just asking because the second material is called "tetrad_mask"), or are those faces that have the white material assigned? If the latter, I don't know how this happens - when I recreate your setup the white part does not disappear on the initial geometry:

base setup

Now when I only want to change the green material on the duplicate object, I can use the Selection input of the Set Material node. I take a Material Index node and plug it into a Compare node set to Equal to choose the index of the material I want to swap. The green material is in slot 0, so here I swap material 0 with a red material:

select material slot 0

The white material on the initial geometry is slot 1, so to swap this with the red material, I compare the Material Index to 1 to select the slot:

select material slot 1

//EDIT: Oh, I almost forgot, there is another quite comfortable way to replace a material: instead of using the Material Index, you could take a Material Selection node to select the material to be swapped. For example, below I chose the Material "green" to be replaced. The good thing is, this way you don't have to care for the index and don't need a Compare node. The bad thing is, if you decide to give the first material slot let's say a blue material, then it will not be swapped with red if you select by material instead of index.

select by material

//EDIT 2: For your specific problem: you have (I guess accidentally?) switched the material link to Object instead of Data. When you use the Join Geometry node it somehow loses the information which parts of the mesh should use which materials and just assigns the first material to the complete object. Change the material slot links to Data (the materials disappear from the slots because the data links do not exist yet) and give them the correct material again, then the nodes work correctly. If you somehow need this Object linking for anything I'm not sure how to work around this (but I think it even works if you only change one material to Data).

material link

$\endgroup$
6
  • $\begingroup$ thank you! this is very useful, yes I have the faces assigned to the material. Your node works for me now, but I had to also use 'Geometry to Instances' node before 'Set Postion' $\endgroup$ Feb 6 at 14:18
  • $\begingroup$ @ellipticaldoor Glad I could help... the Geometry to Instances thing is strange though. Is your initial geometry not simply a mesh? And which version of Blender are you using? $\endgroup$ Feb 6 at 14:21
  • $\begingroup$ @ellipticaldoor I've edited my answer to give you another option for swapping materials - the Material Selection node. The setup is even simpler than my first solution, but both have their pros and cons. $\endgroup$ Feb 6 at 14:33
  • $\begingroup$ I'm trying to make it work without the 'Geometry to Instances' and I can't make it... I uploaded the complete file so you can see it for yourself $\endgroup$ Feb 6 at 14:57
  • 1
    $\begingroup$ @ellipticaldoor Took a while but then I found the difference between our objects... I even appended my object to your scene and gave your object my GN modifier - nothing helped. But then I found it. See the edit at the end of the answer. $\endgroup$ Feb 6 at 15:29

You must log in to answer this question.

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