"Join Geometry" works similarly¹ to object joining in regards to materials. After joining, all faces still point to the same material they pointed to before joining, but the material indices get updated to minimize the number of such indices. For example:
Mesh 1 |
Mesh 2 |
Result of Joining |
0 red |
0 no material |
0 red |
1 no material |
1 yellow |
1 no material |
2 red |
2 blue |
2 yellow |
3 yellow |
|
3 blue |
So first the materials from first mesh are added, then from the 2nd mesh, 3rd mesh, 4th mesh etc.
- Red
- Empty slot
- Red
- Yellow
- Empty slot
- Yellow
- Blue
Then for each material check if it is a duplicate (i.e. also exists earlier on the list) - if so, remap all faces using this material index to the index of the first occurrence of this material, remove this material slot and shift following material slot indices to the left:
- Red
- Empty slot
- Yellow
- Empty slot
- Yellow
- Blue
- Red
- Empty slot
- Yellow
- Yellow
- Blue
- Red
- Empty slot
- Yellow
- Blue
In your case you have a starting geometry with some material, and a new geometry without a material:
Mesh 1 |
Mesh 2 |
0 some material |
0 empty slot |
Then you set all faces of Mesh 2 to material slot 0, which is a no-op, because they were set to that by default. And finally you join:
Mesh 1 |
Mesh 2 |
Result of Joining |
0 some material |
0 empty slot |
0 some material |
|
|
1 empty slot |
Upon joining, the faces of Mesh 2 have their material slot updated to 1
, because without the update the material they point to (None) would change, which is not a desired behavior.
Keep in mind, setting the material index to 0 would work, if you did it after joining, by e.g. capturing a boolean attribute and using it as a selection.
¹ - the difference is object joining keeps repeated materials of the active object.
Set Material
is missing. Without it, no material is assigned to the geometry created in Geometry Nodes. $\endgroup$