How to select all vertices connected to the previously selected vertices, in geometry nodes?

I have a random selection of vertices of a mesh, and i want to find all vertices that share an edge with them, and then change their attributes.
I tried using the “Edges of Vertex” node, but it outputs either the previously selected points, all points minus the selected ones, or nothing, based on the sort index value.

I think this might do what you want.

  1. To test, I build a 20x20 grid and set an attribute (v_attr) to 0.0 or 1.0 based on a random generation (0.2 probability) which looks like this with 1.0 vertices marked,
    ba-vmarking-before

  2. Compare Edge Vertices (in Edge domain) to create a selection of vertices that share a v_attr == 1.0, and for those vertices, set v_attr to 2.0. This is the core of the node tree,

… And this is a display of vertices with v_attr == 2.0

ba-vmarking-after

I’ve attached a blend file that includes the debug display.

ba_vmarking.blend (1.1 MB)

No, not quite
Let’s say i select these 2 vertices

I want to find the vertices that are connected to those 2 vertices with an edge, so for a square grid, it would be the 4 vertices surrounding them, like this

https://docs.blender.org/manual/en/latest/modeling/geometry_nodes/mesh/topology/corners_of_face.html

If you are using 4.2 or higher you can look at this node…

Hope that helps

Sorry, I meant this one…

https://docs.blender.org/manual/en/latest/modeling/geometry_nodes/mesh/topology/face_of_corner.html

Sorry, but i don’t quite understand how i would use it for this, could you please explain?

Perhaps this will assist.

Based on a selected vertex index adjacent vertices can be identified with the edge vertices node similar to below:

adjacent

Node tree example:

adjacent verts1.blend (122.0 KB)

3 Likes

It sounds like you’re close! To identify vertices connected to your selected ones, try using the “Mesh Neighbors” node in combination with the “Edge Vertices” node. Start by isolating the vertices you want to check, then use the “Mesh Neighbors” node to find all directly connected vertices. This method should give you the precise selection you need. If you need more control, you might also consider integrating a “Compare” node to filter out only the adjacent vertices from your initial selection.

Yup, sorry, I was on the wrong track… Ignore me.



Grow Or Shrink Selection 2 - 4.3 - 2024-09-04.blend (144.9 KB)
This nodegroup will grow a selection the number of times set in “Iterations” (will shrink it, too, if you use negative iterations.) Set “Iterations” to 1, and subtract your original selection, and you have all your vertex neighbors.

Based on the “blur attribute” node; I hope it will one day be superseded by something proper.

4 Likes

This worked flawlessly, thank you!

1 Like