How to find nearest connected vertex using geometry nodes?

I’m trying to create a mesh relaxation effect using a geometry nodes network. I thought the below network would work until I realized that the Sample Nearest node was returning the current vertex rather than the vertex nearest to the current vertex.

Anyhow, I was wondering if there was any way to determine for any vertex the position of the closest vertex connected by an edge? I was thinking of using an Edge Vertices node to create a boolean array indicating the neighbors of a given vertex, but I’m not sure how to do that and neither Sample Nearest nor Geometry Proximity allow you to input a boolean mask anyway.

Hi Mark,
the Index of Nearest node is probably what you’re looking for:
image

However it won’t check if that nearest index is also connected to the current index via an edge…

2 Likes

I came up with this, which I think will work. But I am finding trying to follow the logic of nodes like Sample Index a bit tricky. It’s hard to keep track of what domains are being sampled from and what order the different inputs are being evaluated in.

1 Like