4

If you look at the images you'll see I have a basic node setup where noise distorts a mesh. I want to be able to apply this modifier to multiple objects and have the distortion be randomized for each object.

I figured adding a random float value would do the trick, but as you can see it has the effect of changing the scale, which is not what I want.

I'm very confused because from what I know to be true, the W field is simply the pattern of noise over time, so randomizing that value should just give me different noise patterns, not changing the scale.

(original Dropbox link)

quellenform
  • 35,177
  • 10
  • 50
  • 133
Glen Candle
  • 1,740
  • 9
  • 23

2 Answers2

4

You have a constant Seed, but a default ID as the input to your noise:

By default, the ID input is a field, reading the ID attribute of the currently evaluated context (Set Position node evaluates vertices one by one, so the context is a vertex and the ID of a vertex is being read).

You could synchronize the ID for all vertices by just setting it to a single value:

But that still runs the Random Value node multiple times, so maybe just plug the integer there instead:

Markus von Broady
  • 36,563
  • 3
  • 30
  • 99
  • Thank you for this. I still don't really understand, haha, but at least I'm refining my experience with GN's a bit. The problem with this solution, however, is that I'm right back where I started. It doesn't randomize the distortion at all, it just gives me the exact same thing every time. Is there a way to randomize this? – Glen Candle Aug 16 '23 at 18:17
  • @GlenCandle I don't know what you're asking about, there's another question of yours about getting a random value per object. And the comment of XY there points to a solution. – Markus von Broady Aug 16 '23 at 18:26
  • I'm just trying to build a GN setup that gives me a random noise pattern every time the Modifier is used. In other words, I have two identical cubes (or ten or a thousand), and I use the modifier on each cube and get a different result each time. Make sense? – Glen Candle Aug 16 '23 at 18:48
  • @GlenCandle Makes sense, and unlike in Shader Nodes, in Geo Nodes there isn't a "random per object" functionality. So the XY's solution to use a Python script to randomize a different input for each modifier is the only real solution. You could use self location as an alternative, but then 2 objects at same location will have same value, and moving objects will keep changing the value… – Markus von Broady Aug 16 '23 at 20:03
2

this is very normal. you are giving a random value per vertex, so you get a different noise for every vertex defeating the purpose of perrin noise, which is to give gradients.

shmuel
  • 1,560
  • 10
  • Wouldn't the random value just be a single number, since it is set to float? I guess I still don't fully understand GN's. How do I set it up so I just a random single number value assigned to the W-input? – Glen Candle Aug 16 '23 at 06:29
  • 1
    @GlenCandle Useful to know: a diamond-shaped socket is a field, which has a value on a per-vertex basis, if it is a circle, then it can only contain one. The W value in the noise accepts a field, and the Random Value node provides a field of random floats. – lajawi Aug 16 '23 at 08:21
  • 1
    Very useful to know indeed, thanks for that @lajawi – Glen Candle Aug 16 '23 at 18:06
  • 1
    if you want the random value to give a constant then set the ID to a constant. this could be done by plugging an integer input into the ID – shmuel Aug 16 '23 at 20:26
  • @shmuel wouldn't that just negate the randomness then? Or am I not understanding what you mean by 'constant'? – Glen Candle Aug 17 '23 at 22:47
  • @GlenCandle the randomness is pee something it could be per point or per mesh island or per constant. it is true it would somewhat get rid of randomness, but that is what you want. you don't want it random per point. you could set it to a constant, and the random will be per seed. and on every object you'll change the seed (or the constant). or you could use the mesh island node to set the ID to the island index for random per mesh island and then change the seed per object. – shmuel Aug 18 '23 at 22:09
  • @shmuel I did try this, but every time the modifier is used I get the same result and not a random seed – Glen Candle Aug 18 '23 at 22:23
  • @GlenCandle this is because the modifier does give a new seed per object. you have to change the seed per object manually. expose it to the modifier and change it from the modifier panel. I don't know of a way to tell GN to have a different seed per object with that modifier. – shmuel Aug 20 '23 at 02:34
  • @shmuel gotcha. My plan is to apply the modifier to many objects (hundreds or more) so I really need a solution to automating the random seed. I'm very surprised that this is so hard to pin down, seems pretty basic in regards to building large scenes. I find it very odd that there isn't simply a 'random integer' node that will send an absolute value to a field, as opposed to 'playing the field', pun intended ;) – Glen Candle Aug 20 '23 at 18:41
  • @GlenCandle it's very hard to understand your wording. what you are looking for is a way to have an ID per instance if a modifier and there isn't one built into geometry nodes. – shmuel Aug 20 '23 at 23:41
  • @shmuel sorry for being confusing. In short: I just want to be able to make it so every time I add a GN modifier to an object, a random number is given to the W input in the Noise node (without requiring any human input). But since this input is treated as a field instead of a single value (which is confusing, because by default it is a single value), I cannot simply use a Random Value node. So far I have not found a workaround. The ideal solution would be to force a single value into a field input, but I guess this is not possible. – Glen Candle Aug 22 '23 at 18:06
  • @GlenCandle you completely misunderstand how this works. of course you can use a single value in a place where a field should go. what is going on here and why this doesn't work is because the node tree acts the same on in every modier and making it a field wouldn't help. the field are based on the geometry and if the geometry is the same so to will the random value. the only way you could get a different value on different objects with the modifier is through the group input (or the self object node) – shmuel Aug 22 '23 at 21:20
  • @shmuel I don't think it is fair to say that I "completely" misunderstand, though I will grant you there is some confusion. All I'm saying is that, if you don't plug a node into the W input, you are using a single integer, and changing that value accordingly acts as a 'seed' that gives different results per number. However, plugging in a Random Value node into the W input doesn't act as a single integer, it applies a random value to an entire field, which results in a noise pattern that is much smaller in scale. I think perhaps you are "completely misunderstanding" what I'm after here. – Glen Candle Aug 23 '23 at 15:41
  • @GlenCandle the default ID is the ID which defaults to the index, so you are giving a random value per index. (so every vertex)

    your question of how to get a random constant per modifier is a valid one. however, there is no good way I know of to do this. you could make it location based (but that will change the seed whenever you move the object). perhaps a driver or python could work. The behavior you are getting is very normal, though.

    – shmuel Aug 23 '23 at 20:22
  • Yeah I understand now why my solution can't work, but in my opinion there should be a node created that sends a single value to any field input, for instances where you'd want this (a "Constant Field Input" node or something like that). Someone mentioned python, I'm just not comfortable with python so I'll just move on to another hack. Cheers. – Glen Candle Aug 24 '23 at 21:35
  • @GlenCandle the issue here has nothing to do with fields. you could always put a constant into a field and there are many ways to turn a field into a constant. what you need is a modifier or object ID, which we don't have and it would be nice to have something like that. – shmuel Aug 24 '23 at 22:16