# How can I use Geometry Proximity and blend between several meshes (that have the same vertex count)

This is continuation of this question, which was answered nicely.

So, I can now make this happen: But I would like to be able to use Geometry Proximity to control the point where the trees are growing from. Like this, in a way: But obviously I don't want the trees being distorted in there.

So how can I achieve this without the trees being distorted? Maybe something to do with index and the amount of vertices in the initial tree object?

(I know this exact thing can be done with curves and endpoint-selection, but I would like to apply this 'shapekey'-method to way more complicated purposes than this simplified tree situation.)

Here are the nodes of the topmost GIF:  You can solve it by using the Capture Attribute node like this: # Explanation

The context of the Mix node are the single vertices of all the trees. If you want to morph every tree instance with a constant value, then you need to use the same mix factor for all vertices of one instance.

If you would simply like to scale your instances, you could go for the solution, proposed by Kuboa, and scale the instances during instantiation. But you can't do this in combination with the Mix node solution.

Starting at a single vertex of a tree, the idea is, to use the position of the point, that was used to instantiate this tree, for calculating the mix factor of the vertex. This is the point, where the Capture Attribute node comes into play: In this case, the Capture Attribute node writes the index of the current point into an anonymous attribute, that is attached to the point itself.

When creating and realizing the tree instances, every vertex of these instances will inherit this attribute: When we calculate the mix factor for each vertex, we can use this information to read the position of the related instantiation point. To read this anonymous attribute, that is bound to the current vertex, we simply connect the Attribute output of the Capture Attribute node to the Index input of the Transfer Attribute node as shown below. This way, we read the position of the instantiation point, that has the index, that was stored in the anonymous attribute of the vertex in the current context.

Next we use this, to calculate the distance from the instantiation point to the reference point. In this example, the reference point is set to (0, 0, 0). You could as well connect the location of an empty here, if you like - comparable to the solution of Kuboa.

Finally, we calculate the mix factor by inverting the distance and multiplying it with the animation factor.

# Alternative to using the Capture Attribute node

Instead of using the Capture Attribute node, we could as well calculate the index of the instantiation point based on the index of each vertex of a tree. This is possible, because every tree instance has the same number of vertices: # What about using the Geometry Proximity node

My first idea was, to use the Geometry Proximity node like this, where the target is connected to the original points: This in fact works, if you pull down the Density Factor of the Distribute Points on Faces node to 0.05. But for higher values, the trees get distorted. This happens, because for some vertices of a tree, foreign points are closer than the related point. Thus, these vertices are assigned to the wrong original point and they start growing earlier or later than the other vertices of the same tree. This distorts the tree.

• Excellent! Thank you! :D This helped heaps! Apr 19, 2022 at 17:24

A bit edited version of André's answer to suit my needs: Works like a charm! Thank you André!

Here are the node changes: Now off to make some nice stuff with this technique! -> whee!

I couldn't tell exactly the effect you're going for, but here's a setup where I'm controlling the scales of the trees via their Instance on Points nodes, using a control empty. Empty's scale also comes into play for extra granularity:   • Thank you! This certainly solves this specific issue - but André's solution works also if, say, there was 4th object 'tree3' in where the green ball flattens... or ... the trunk is modeled to go twisting instead of being straight... sorry can't explain clearly. But yes, your solution is good for some things, sure :) Thanks! Apr 19, 2022 at 17:43