3
$\begingroup$

How can I select ALL verts of a mesh to send to the Selection input socket?

In this case, for example, I want to assign a material to all of one object's geometry before joining it to some other object's geometry.

I know it can be done by creating a Vertex Group and assigning the verts to that group manually, but I would like to know if it's possible to select all the vertices of an object's mesh geometry regardless of groups. Thanks.

$\endgroup$
1
  • 1
    $\begingroup$ By default the Selection socket doesn't filter out any item, so all vertices should be affected. Although in this case the node affects faces and not vertices since they are the ones that hold the material information $\endgroup$
    – Gorgious
    Commented Feb 19, 2022 at 9:40

1 Answer 1

6
$\begingroup$

The default Selection value is ✅ True, so both setups below are equivalent:

Worth to note, as Gorgious says in a comment, a material slot is assigned to faces, not vertices. You can assign some data to vertices or face corners (face + vertex combination) and use it in a shader.


Update: It seems Set Material looks for a slot that already has the specified material, if it can't find one, it creates a new slot. Then it loops over all faces and each time it evaluates Selection input field for that face to ✅ True, it assigns the found/created material slot to it. This is why the OP's file changes the color of some geometry:

  1. Ico Sphere node creates a mesh with one empty material slot (connect directly to output and apply the geonodes modifier to see).
  2. Set Material looks for a material slot with Material1 material in the connected geometry. It finds none, so it adds a new material slot index #1, and then iterates over all faces and for each, based on ❌ False input, it decides to not assign the face to the material slot #1, leaving it at the default #0.
  3. The original geometry has no material slot.
  4. Set Material looks for a material slot with Material2 material in the connected geometry. It finds none, so it adds a new material slot index #0, and then iterates over all faces and for each, based on ❌ False input, it decides to not assign the face to the material slot #0, leaving it... At the default #0! This means the original geometry now is assigned the material, even though no material slot was changed on the geometry!
  5. Geometry is joined. Material slots are added (in this case no merging of material slots happens, as they all point to different materials). Ico Sphere still points to material slot index #0, but the original geometry, being an added geometry (see Join Geometry ordering), gets an offset on all material slots indices based on the number of material slots of previously added geometry (1). So its index becomes #1, and it still points to the assigned Material2.
$\endgroup$
5
  • $\begingroup$ Thanks! Well the good news is I learned something. The bad news is that there is some other reason why the materials on my object aren't being assigned correctly. :-) $\endgroup$
    – Mentalist
    Commented Feb 19, 2022 at 11:39
  • $\begingroup$ BTW, I found that whether the Boolean node's Value checkbox is ticked or not, the Set Material node always assigns a material to geometry coming from the Group Input node. Not sure if this behavior is intended or a bug (as of ver 3.0.1). Here's a .blend to demonstrate. $\endgroup$
    – Mentalist
    Commented Feb 19, 2022 at 11:39
  • $\begingroup$ @Mentalist good news, it's not a bug. Also good news: I learned something as well - see the edit. $\endgroup$ Commented Feb 19, 2022 at 14:36
  • $\begingroup$ Nice detective work and explanation! So basically, if Set Material isn't working as expected, we can try adding an empty slot on the original object. OR run the original geometry through two Set Material nodes - the first one with no material specified (to generate the empty slot), and the second one specifying the material we actually want to assign. $\endgroup$
    – Mentalist
    Commented Feb 19, 2022 at 14:59
  • $\begingroup$ @Mentalist I think the safest technique is to use a material node without a material (set material to None), with no faces selected. This way if there wasn't a material slot, you add one and assign all geometry to no material. At least if that's what you want to do. $\endgroup$ Commented Feb 19, 2022 at 18:56

You must log in to answer this question.

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