Random Value geometry node, single random value per instance

I’m trying to randomize an aspect of an instanced object. In this case, that’s the position of points within a grid being used as an instance. In this setup, I have a grid with the number of cells controlled by an integer input. I’ve converted the faces to points, then instanced a new grid on each of those points.

For this proof of concept, I’d like to pass a random float into each instance to move vertices 1,4,7 +/- Y and 3,4,5 +/- X. I’ve got no issues moving the vertices so I’m not showing the details of the Grid Deform node group. It works great when use a Value input node instead of a Random Value node.

The two problems:
#1 the Random Value node is supplying a different value for each vertex of the instanced grid. I only want one value.
#2 the Random Value node is not providing different values for each instance.

Is there some way to get the Random Value node to evaluate using the index of the instance instead of the nine vertices? This might solve both problems.

You cannot randomize other values than rotation/position/scale of instanced objects (but not “inside” an instance). That’s in the “nature” of instance objects because they are just references to that object. You have to use a total different node tree. Unfortunately you did not describe your end goal precisely (or i didn’t understand it) but you could use (if i understood you right) a node setup like this:

as you can see you have a “constant” value by the ID per instance, and with this you can do whatever you want (i just moved the instance - of course you can do what you want) and you get a constant random value by using a texture (as i did) but you can also use a random value node and connect it to the seed value

1 Like

What I’m trying to get to is a procedural single row grid with a nested grid centered on each cell, such that when new cells are added a new nested grid is inserted on the face of the primary grid. To simplify my earlier description, each nested grid would have random placement of the center point.

(example created the hard way, using three unique grids instead of instancing)

In my original testing I tried using the noise texture to generate randomness and that worked better than trying to use the Random Value node, but my mind keeps trying to make the Random Value node work. I had probably give up on that.

After the Realize Instances node you can get each vertex by its index. Can you think of an alternative where after the Index on Points you can do something like reference vertex 4 of instance 2?

Managed to answer my own question after some fooling around. Thanks for getting me thinking the right way.

I used the Modulo node to calculate multiples of four, which would be the index of the center point of each grid. The Noise Texture node gave me the randomness. The Map Range node gave let me make the randomness both negative and positive values for the move.

Thanks for the help!

1 Like

you need to capture some attribute at the right time and use them latter !

Before instancing, you can capture the vertex’s index of the grid.
You can also capture the index of the points.

Then you instance, and realize instance.

But the attribute you’ve captured will still be accessible, and from that you can manage to do what you want.

But you answered in the meantime with another solution, which seem simpler.
Well done !

1 Like