7
$\begingroup$

I'm making a small medieval city using geometry nodes in Blender 2.93, where each building is a separated object, but they all share the same modifier list (and the same geometry nodes). I added some randomness to the height of the buildings by using Random float node.

How to setup up the seed of the random float node, so that every object has unique seed, even though they all share the same geometry nodes?

I was thinking about using objects unique position, but I don't know how to get that value within geometry nodes.

I could expose the seed in the modifier stack as an input variable and add a driver to it that generates a random number (round(noise.random()*1000)), but it seems that it generates a random number every time a render is made, essentially changing the whole city between two shots.

Anybody has better solution?

enter image description here

$\endgroup$
5
  • $\begingroup$ Are you using Instancing of the houses on a parent plane? Instancing is very limiting as explained [blender.stackexchange.com/a/159469/111042]... and describes a solution using Hair Particle Systems, where you can vary the Scale of the Object Instances, with the downside that some of your houses may overlap -- which may be acceptable if the housing is viewed from an angle, and perhaps overlapping houses are just "more complex houses". This also varies width length and height. $\endgroup$
    – james_t
    Apr 26 '21 at 16:18
  • $\begingroup$ why can't you use attribute randomize? can you show us your nodes please, at least the ones where you set the height of the houses? i thought this is basic stuff..... $\endgroup$
    – Chris
    Apr 26 '21 at 16:25
  • $\begingroup$ @Chris What I have is a plane, that gets some volume from a solidify modifier and then I'm generating the house in geometry nodes. To generate the random height of the houses, I'm using this setup where I'm duplicating the box made with solidify modifier. I'm not instancing the houses using Point instance. I'm sure you can help me if it is basic stuff ... $\endgroup$ Apr 26 '21 at 17:51
  • $\begingroup$ Sorry - I cannot even read anything in the image...maybe you should provide the blend file or a simplified node tree with a blend file - it is easier to help instead of rebuilding all nodes $\endgroup$
    – Chris
    Apr 26 '21 at 18:09
  • $\begingroup$ I'm trying to do the same thing, but with objects that have the location animated, and I want the scale to be random by object but static (the scale shouldn't change over time), so getting the location to randomize the scale doesn't work in my case. Any way to get a true random number/seed by object? $\endgroup$ Jun 9 '21 at 14:41
6
$\begingroup$

The geo-node-network containing the random height functionality is executed only once per instance. So if you're instantiating the buildings from a single object mesh or collection instance it will be all based on the same random value.

I had a simular issue and solved it by creating a collection of instances and letting the point instantiate node pick random items from that list. I used the location of the instance to select a height value, but you can also use it as a seed value.

enter image description here

To get the position of the object within the associated geo-node-network:

  1. Add an empty object at the world origin
  2. Add an Object Info node to your network
  3. Set the offset toggle to Relative
  4. Add a Vector Math node and multiply the location by -1,-1,-1
$\endgroup$
2
  • $\begingroup$ I apologize for late reply, I got caught in different projects. I returned to my original project today and took at look at your answer. With only a minor alteration I managed to get it running. I added a separate xyz node after your vector math node and then added all 3 XYZ values together. Then I multiplied the result by 100 to make it more sensitive and rounded the result. An excellent solution. $\endgroup$ May 29 '21 at 21:20
  • $\begingroup$ I'm trying to do the same thing, but with objects that have the location animated, and I want the scale to be random by object but static (the scale shouldn't change over time), so getting the location to randomize the scale doesn't work in my case. Any way to get a true random number/seed by object? $\endgroup$ Jun 9 '21 at 14:41
2
$\begingroup$

I use the Random Float input passing in a Seed from outside as its seed. Then every time you need a new random value, just add another Random Float input node using the last one's value as the seed for the new one.

This provides me with one new random number for each object in my node tree that I want to be different, but all ultimately from the same seed, so I can keep it the same between frames.Node Setup to get multiple random numbers for seeds

$\endgroup$
0
$\begingroup$

I had the same problem, also making a city:

  1. create an empty in your scene
  2. In your Geometry Node tree you can grab the empty´s position with an Object Info node.
  3. If you put it to "Relative" the location is relative to the current object the tree is applied to. Now you can use the location as input for seeds.

That way the seed is dependent on the objects location. disadvantages:

  • It only works on none moving objects
  • Objects at same location will have same seed
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.