1
$\begingroup$

I'm trying to create a setup in Geometry Nodes that will allow me to select from a series of pre-chosen materials using an integer value in the modifier tab.

The problem I'm running into is that the 'Set Material Index' node uses all the existing material slots on the object (which I want to keep but not use) - Is there a way to customise this index so it only chooses from the ones I've added in the GN setup?

enter image description here

Any help would be greatly appreciated thank you!

$\endgroup$

2 Answers 2

3
$\begingroup$

You need to add more Material Slots and include only the Materials you want to use:

enter image description here

This way you don't have to use multiple Set Material Nodes.

If you want to keep for some reason the Black material as Second in your material slot but replace the index 2 with 1, 3 with 2 and so on - simply add a condition like this:

enter image description here

Edit: For more complicated material selection - Say, you have a Car Parts in one collection - "Car":

enter image description here

Create a Plane outside of the collection with no materials

enter image description here

There should be already materials on other objects that you want to use

enter image description here

Add Geometry Modifier that will do the following material selection (sorry for the bad compression)

enter image description here

Copy the Geo settings from here;

enter image description here

enter image description here

Demo .blend file here:

$\endgroup$
4
  • $\begingroup$ Unfortunately that still won't quite work, as I have upwards of 20 material slots with only 4 I want to choose from for this particular element (I just set it as 1 black one for this simple demo) Would realizing the instances help? Almost like making it a separate object with new material index with only the included ones in GN? To give more context it's a model of a car so it has a lot of different materials that I want to have separate selections for i.e: Wheel slider only selects from Rubber materials, Glass slider only selects from colored Glass materials etc.. $\endgroup$
    – JaRa
    Commented Oct 29, 2023 at 2:56
  • $\begingroup$ Hi JaRa. Unfortunately there are not many universal answers to questions. You need to provide as many details as possible to answer your question. I would suggest editing your current question or create a new one explaining exactly what you want to do, how your model is set up, preferably with screenshots and/or a blend file for testing. $\endgroup$ Commented Oct 29, 2023 at 10:08
  • 1
    $\begingroup$ Hi JaRa, edited the answer to cover the additional constraints. Try studying the demo blend file attached to the answer and modify it to your needs. $\endgroup$ Commented Oct 29, 2023 at 11:36
  • $\begingroup$ ok amazing - hopefully something like a "Custom material index' node will be added in future to make this process easier but this is a great solution in the current build, thank you! $\endgroup$
    – JaRa
    Commented Oct 29, 2023 at 23:16
0
$\begingroup$

Nevermind I think I was overthinking the problem a bit... I realised if I just delete all my material slots and then do it entirely via geometry nodes I can separate out my different mesh elements and build each one a new index from set material nodes likeso:

enter image description here

$\endgroup$

You must log in to answer this question.

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