Getting a random seed value per object, if they all share the same node tree

I’ve spent the last hour trying to figure out what I’m supposed to do with this information. Failed.

I have no clue how to get the origin location of the objects that have the Geometry Nodes Modifier active on them.

image

So I tried adding an empty at the origin and then if I could measure the distance from Object A to the empty, it would be a different value from Object B to the empty. I could plug that into the W… but I can’t figure out how to get that measurement.

How do you get the xyz position of the index 0 point of the default cube and then measure the distance from that point to the location of an empty?

edit

I did it. I forget to use Relative on the Object Info node.

1 Like

What i meant was that you can use a driver to calculate the distance to the world origin in the same as with the adding an empty trick.

Or a unique number which you get when doing object.location.x + object.location.y + object.location.z. No need to calculate the real distance. You may need to multiply the calculated number afterwards if you are working on a smaller scale:


The driver shown on the right is set to the seed input field (Could also be set direct on the random value node).

When you copy an object blender is smart enough to change the object reference in the driver to the new object(if it was itself on the source object).

Did that helped or was it something else you wanted to be elaborated?

1 Like

That is exactly what i am doing. Maybe i have expressed myself a bit complicated.

Ah Ok, sorry the screen shot confused me a bit :blush:

1 Like

No need to delete your post, i think your screenshot was still of use for better understanding. That was how i wanted to take the screenshot but my program of choice was not able to do it that way.

1 Like

:slightly_smiling_face: thanks, here is my screenshot again, it is the same as moshus’s answer.

1 Like

Does anyone know any way to do this that doesn’t rely on the position? I’m working on an animation and need it to work for objects that will move around.

I posted a feature request on right click select, but for some reason it didn’t get any attention.

I would do the same as was suggested above : expose the seed on the modifier (instead of relying on the position values), and change it on all objects (to a random number) using Python, so you only have to do it once

1 Like

you can use index as seed and a multiplier

It’s different objects, so you can’t rely on the instance index, if that’s what you meant

Doesn’t shaders have a random per object in the object info node? No chance of Geometry Nodes getting that someday?

1 Like

Something like that would help yea… There was mention of object UUIDs which would probably help just as much, they could be used as seed in a random value node

I know it’s an old thread but I’ve added a patch to allow objects to have a ‘seed’ property and expose this in the Object Info node in GN.

This isn’t a UUID even though it uses a UUID to generate the seed.

13 Likes

Yes, please and please. It’s sort of weird that GN hasn’t the capability to just create a random value for its own object, and every node combo I’ve come up with to get over the finish line is still just a hacky workaround.

(Like - Blender knows the object is unique. If I click an object, it doesn’t just select some other object. So why can’t I have a unique ID in the node to use as a seed value?)

This is really welcome, cheers

i can’t find this sort of seed however for my purposes i generate a seed from my object position

this allows my object to randomize something, and it’s not per vert it’s per object position… the seed is generated by multiplying the axis x y z by prime numbers so the seed will always be unique… it’s only weakness is if the object positions were too close together the result might be the same, but thats what the final multiply trys to correct

Also if the objects move.

1 Like

yes but that can be an advantage, it is the closest behaviour i believe possible as now it allows a different seed number for each duplicated node i can’t see how you could have an actual unique key other than maybe if blender could give the hash of the object name

my method run into a problem so i added a truncated modulo to avoid invalid seed numbers

That’s the issue I had with object position. One gets all the values set as you like…move the object, and now it’s all different.

Yes it would be great to have something like an object index at scene level as an attribute.