0
$\begingroup$

How does the "Index Of Nearest" node work in blender 3.6?

$\endgroup$
4
  • $\begingroup$ Hello and welcome. Thank you for sharing. Can you kindly separate the answer part from the question? Post the answer as a separate answer post. $\endgroup$
    – Harry McKenzie
    Commented Apr 2, 2023 at 1:05
  • $\begingroup$ @SpicyMelon.. when (and if) you split the answer portion out, can you include a link to documentation / the version you're talking about? I can't find this node. $\endgroup$
    – Robin Betts
    Commented Apr 2, 2023 at 11:47
  • 1
    $\begingroup$ Usually we are focusing on officially released versions here, since the main goal of this site is to help with issues which is pointless if the problem exists in alpha or beta builds of Blender which might be subject to change before they are released. This might not be the case here, but even simple things like the inputs you listed here might be different when 3.6 is finally released. Apart from that, as Harry already pointed out, please put the answer in the answers section, don't enclose it in the question. Users looking for this question will only see it as unanswered in the list. $\endgroup$ Commented Apr 2, 2023 at 13:53
  • $\begingroup$ Ah ok I see, thank you for your feedback everyone. I had no idea! So I fixed HarryMcKenzie request and also RobinBetts request. As for GordonBrinkmann comment, that makes sense, yes thank you. I didn't realized this was only for main builds but that makes sense. Should I let this post stay? Or remove it until it comes out officially? Could be a long time though. $\endgroup$
    – SpicyMelon
    Commented Apr 4, 2023 at 20:42

2 Answers 2

1
$\begingroup$

I have been searching for an answer to this for a while but fortunately I have figured out how it works and thought it would be nice to put it out there for others if they have the same question.


The Index of Nearest node is a vector math node in Blender's Geometry Nodes editor that allows you to find the index of the nearest point or vertex within a specified group or category. The node is available in Blender version 3.6 for the specialized PR104619 build. You can find it here: https://builder.blender.org/download/patch/blender-3.6.0-alpha+main-PR104619.3edcc6a4a83a-windows.amd64-release.zip

The node takes three inputs:

'Position' defines the vector in space that the distance calculation will use,

'Self Group ID' defines the group or category that each point belongs to, while

'Group ID to Search' specifies the group or category to search for the nearest point.

The node outputs the index of the nearest point within the specified group or category. If 'Group ID to Search' and 'Self Group ID' are the same, the node will exclude the current point from the search results.

This node can be useful in various applications, such as creating particle effects, controlling the behavior of simulations, and generating procedural geometry."


Pointed out by Mod Nop:

  1. First, the positions are split into groups based on their Self Group ID.
  2. For each group, a separate KDTree is built.
  3. If no Self Group ID is provided, all positions are put into the same KDTree.
  4. When searching for the nearest node, a Search ID is used to specify which KDTree to search through.
  5. If no Search ID is provided, the same KDTree that the position is in will be searched.
  6. The KDTree is built by recursively partitioning the positions based on their coordinates.
  7. The KDTree is then used to efficiently search for the nearest node to a given position.
  8. The search can be either within the same group or any other group, depending on the specified Search ID.
$\endgroup$
0
$\begingroup$

Foreword: Index of Nearest node isn't accepted yet. So you cannot find this node in 3.6 builds. But you can find this node in specialized build of PR.

Answer. Technically Index of Nearest node build KDTree for eaht positions. After that each position lookup nearest other one. Groups used for:

  1. Splitting positions during KDTree building in multiple different KDTree.
  2. Splitting positions for lookup nearest one. If second one socket (Group ID to Search) isn't connected, this group is the same as first one.

As a result, the search can be either within the same group or any other group. More about what KDTree is: https://en.wikipedia.org/wiki/K-d_tree

$\endgroup$
2
  • $\begingroup$ So let me see if I understand you. Each point is put into a KDTree based on the Self Group ID. If no ID is provided then they are all put into the same KDTree. Then for the Search ID, this is telling which KDTree to search through to find the nearest point in that KDTree. And if this search ID isn't provided then it searches the same KDTree that its in? I will add to my answer with this information! Let me know if I get it wrong! $\endgroup$
    – SpicyMelon
    Commented Apr 4, 2023 at 20:51
  • $\begingroup$ Actually, it's really not that clean and it can be changed. I found this description: Imagine that the vertex is in school. The first input says which classroom she will be in. The second talks about which classroom to look for a friend in. $\endgroup$
    – mod nop
    Commented Apr 5, 2023 at 16:42

You must log in to answer this question.

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