4
$\begingroup$

I have a mesh where I initially assign a material to faces based on their normals' angles (an example is provided in the attached .blend file). This initial selection method works, but I need to refine it using a specific rule for assigning and removing materials based on the connectivity of faces.

Here’s the rule I’m aiming to implement:

  • Assign Material: If an empty face without a material is connected to at least two faces with the material, that face should also be assigned the material.
  • Remove Material: Conversely, if a face with the material is connected to only one or no faces with the material, the material should be removed from that face.

In the screenshot you can see the original selection on the partially red suzanne. In the green one, what I want to achieve in an example crafted manually for the sake of clarity.

Example

Attempting to find a solution I discovered (and was surprised) that I can expand the selection using Blur Attribute node, but that is not what I want. Thanks for your help.

$\endgroup$
4
  • 1
    $\begingroup$ Finally a question asked in a proper way. :) Minimized working example, a readable screenshot, and very understandable text. $\endgroup$ Commented 2 days ago
  • 1
    $\begingroup$ I found 2 problems however: one small problem is that you didn't explicitly state it should be iterative process, which I figured based on how the loops are filled or disappear far from the color that would initially affect it. Second, bigger problem: the algorithm won't work as you predict: consider the loop on ears, you expect it to disappear, but according to the algorithm it should simultaneously disappear from the dead-end, and thicken from the connection with the thicker part: i.imgur.com/fsFUxXP.png - if that's desirable, it's not clear what about the overlap of the arrows... $\endgroup$ Commented 2 days ago
  • $\begingroup$ First problem: Yes, the process should be iterative, perhaps with a repeat zone and a controllable number of repetitions? Actually, I wouldn't know how to do it. Second problem: You're right, I hadn't thought of this possibility. Actually, I think either approach would be fine for me (maximizing the growth of the selection, or minimizing it). Assuming it is possible! $\endgroup$
    – crucchi
    Commented 2 days ago
  • 1
    $\begingroup$ Geonodes are turing-complete so it is possible of course. I'm just starting my movie evening however... $\endgroup$ Commented 2 days ago

1 Answer 1

3
$\begingroup$

I have to go, so just a quick prototype, for one-way (only grow) - it just happens to give the result you want for the example, but I know if there was a 2-face separation on the ear loop, you would expect the separated part to disappear, and this doesn't do it:

And this goes the other way:

So if you do the first, then the 2nd, you're probably fine, but there's also a question of how many iterations (I did 100) - you need to implement a "while" loop. It can be done, and I've wrote an example on how to do it here:

Implement "while" loop in Geometry Nodes

And here's the screenshots from my answer there:

Mat Fix:

Loop Test:

Loop Body:

You can unmute the node above, so that the selection both grows and shrinks. This will yield such result:

(look at the ear)

$\endgroup$
3
  • $\begingroup$ I have tested both solutions. Besides being sufficient for my purposes individually, they perfectly solve my problem when used in combination. Thank you very much. If you actually find the time to create a version that only performs the necessary number of repetitions, I would be really curious to see and understand how it works. Thanks again. $\endgroup$
    – crucchi
    Commented yesterday
  • 1
    $\begingroup$ @crucchi I'm working on that. :) $\endgroup$ Commented yesterday
  • $\begingroup$ @crucchi see edit. $\endgroup$ Commented yesterday

You must log in to answer this question.

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