I'm trying to find the nearest face on each object in a collection to a reference object, but the Geometry Proximity node is only returning one point - the nearest face in the entire collection.

The image below shows the node setup - I have a Collection Info referring to the collection of objects (3 cubes at varying distance from the reference object the sphere), then a Realize Instance node because Geometry Proximity won't work on instances. Then I have a Points Node to create points from the Geometry Node position output - but it only crates one point, not one for each object in the collection. The rest of the nodes are just for display purposes.

Proximity Test Node setup

The image below shows the scene setup - a UV sphere as the reference object and three cubes. The red star is placed correctly on the nearest face in the entire collection (the cube in the middle background).

Scene setup

I know I'm probably missing something really simple, but at this point I've gone node blind. Any help will be appreciated.

SIMPLIFICATION: I only want to find the nearest face to the origin of the reference object. That should remove the need to test every face on the reference object with every face on the collection objects.


1 Answer 1


When you realize your instances they become a single big mesh, and then Geometry Proximity finds the closest point (not points) on that mesh. We will eventually have iterative processes like loops in Geometry Nodes and when that happens we can do this calculation for every individual component as you are imagining now, but as of yet this is not doable, as far as I'm aware.

However, if there arent't too many objects in your collection and you're alright with a bit of manual duplication, you can use a setup like I'm showing below to get the closest points one by one:

enter image description here

Here's what's going on inside the custom node:

enter image description here

First it samples the input geometry for a named attribute called "n_index". For the first copy of the node group, this is $0$, since that attribute doesn't exist yet. It uses this integer value as an instance index to choose only the first one among the collection children and delete the rest (Delete Geometry). It realizes this chosen instance, finds the closest position on it with Geometry Proximity, and places a point at that position. In the meantime, we add $1$ to that n_index value and capture it on our geometry (at that moment, a single point) after joining it with the original point we inherited from our Group Input (at that moment, none).

When we duplicate our custom group next time, it'll sample the n_index and actually find a value—$1$, then add $1$ to it and capture it with the same name again. This way, with each new copy of the node group we raise the index by $1$, delete all instances except the one with this new index, Join a new point at its closest point, and so on and so forth...

  • $\begingroup$ Would I need a copy of the node group for each object in the collection? If so, would I be better off using an Object Info node and the Geometry Proximity node for each? Nice imaginative solution though. $\endgroup$ Jan 25, 2023 at 14:26
  • 1
    $\begingroup$ @BrianPower Yes, one node group for every object. Object Info node would require you to select objects one by one from its dropdown so it would be much slower, no? With this setup you just select one Collection and it goes through the objects by itself. $\endgroup$
    – Kuboå
    Jan 25, 2023 at 14:29

You must log in to answer this question.

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