2
$\begingroup$

I have a simple plane object emitting randomly scattered instances. I'm using a Math:Wrap node that causes the instances to return to their original Z:0 position upon reaching Z:1.

What I can't get to work is: I would also like each instance to individually reshuffle its position randomly on its X and Y axes when it passes each whole number of distance value.

This visual reference shown from the up-facing plane's Front View illustrates how although the instances are randomly spaced on their Z axis, they do not shift at all on X (or Y).

Geometry Nodes instances spaced randomly on Z axis, but not X or Y

Node setup:

Geometry nodes - setup for random Z axis spacing and cyclical movement

So unlike the "looping" cyclical Z movement, the X and Y movement should shift in a stepped manner: No movement for many frames, and then one sudden movement.

How can I get this kind of movement on the X and Y axes?

$\endgroup$

2 Answers 2

2
$\begingroup$

$$\mathbf{\text{Method 1}}\text{: On XY Rectangle}$$ $ $

enter image description here

enter image description here

Advantages:

  • True pseudorandom position for every height cycle.
  • Point count is definable.

Disadvantages

  • Can only emit points from a defined Rectangle on the XY plane.

With Size X and Size Y provided, it's possible to generate a random vector with limits equal to: $$\text{Min}=\left (-\frac{\text{SizeX}}{2}, -\frac{\text{SizeY}}{2}, 0 \right), \text{Max}=\left (\frac{\text{SizeX}}{2}, \frac{\text{SizeY}}{2}, 0 \right)$$

That's what's used to generate the horizontal position for a point.

First, a Mesh Line with a custom number of points is generated, then we generate a random value for the starting height limited to the maximum height, this value is then added with the scene time and wrapped with the maximum height.

Now we need to get a random position on the rectangle, one that changes every time the height is resetted. For that, we divide the initial height added with the scene time by the maximum height, the result is then floored which results in a value equal to the index of the height wrapping cycle. We can use this value as seed to generate the horizontal positions of the current cycle.

Geometry Nodes of Method 1

enter image description here

All methods in Blend file:

$ $ $$\mathbf{\text{Method 2}}\text{: On Surface}$$ $ $

Note: here points follows surface normal, if that's not desired just use combine xyz instead of multiplying height by normal.

enter image description here

enter image description here

Advantages:

  • Emits points from surfaces.
  • Can be easily modified to support minimum distance between points.

Disadvantages

  • Point count is not definable.
  • Point horizontal position is limited to the positions of all generated points, which causes a lot of points to be on the same line.

With this method, for every height cycle of a point, we use as horizontal position the position of a random point of the distributed points.

We use the same way as the previous method to get the height cycle index, value that now is used as seed to generate a random index limited to the point count, the result is used to get the horizontal position of another distributed point.

Geometry Nodes of Method 2

enter image description here

All methods in Blend file:

$ $ $$\mathbf{\text{Method 3}}\text{: On Surface, More Random}$$ $ $

Note: here points follows surface normal, if that's not desired just use combine xyz instead of multiplying height by normal.

enter image description here

enter image description here

Advantages:

  • Emits points from surfaces.
  • Point count is definable.
  • Perceptually random position for every height cycle (depends on supplier density).
  • Can be easily modified to support minimum distance between points.

Disadvantages

  • Slower when enormous density is needed for the supplier point cloud (Increasing quality of random position per height cycle).

This is very similar to the second method, but now it generates a fixed number of points using a Mesh Line, distributes a lot of points on the base besh, and then for every height cycle of a point in the line, it picks the position of a random point of the distributed points.

Geometry Nodes of Method 3

enter image description here

All methods in Blend file:

$\endgroup$
6
  • $\begingroup$ This is awesome! I really appreciate the effort you put into this high quality answer. :-D $\endgroup$
    – Mentalist
    Commented May 31, 2022 at 19:13
  • $\begingroup$ For the last technique demonstrated in your answer, I tried adding a Realize Instances node... this seemed to cause the material to stop displaying. Do you know if it is possible to Realize Instances with that setup? Thanks. $\endgroup$
    – Mentalist
    Commented Jun 6, 2022 at 13:10
  • $\begingroup$ A bigger issue is that I'm getting z-fighting between my instance planes. Is there a way to maybe instance planes of instancers, like in batches that are equally spaced apart? I think if they can be spaced equally on the Z-axis, Poisson Disc distribution will be enough for XY. Is this making sense? Or maybe there's a way to space each new instance a fixed distance from the last one? (I can ask a new question for this if necessary. But I wanted to mention it to you first.) $\endgroup$
    – Mentalist
    Commented Jun 6, 2022 at 16:37
  • $\begingroup$ @Mentalist The material will work as long as it's link is set to data. Now, if you're using the instance UV in it's material, you will need to use the Attribute node in the material to get the attribute with the same name as the uv layer, this is needed because when realizing istances their UV's are converted to attributes. $\endgroup$
    – Hulifier
    Commented Jun 6, 2022 at 18:29
  • $\begingroup$ @Mentalist about the z-fighting, I'm not understanding the problem very well, but it sounds like it would be a good idea to ask a new question for it. $\endgroup$
    – Hulifier
    Commented Jun 6, 2022 at 18:31
0
$\begingroup$

You can use a map range node, on "stepped linear" mode, to do what you want:

enter image description here

The map range node here maps frames 1-11 to an X translation of 0-20, in 5 equally sized steps-- so at frame 1, we'll have no translation, and that will last until frame 3, when we'll have a translation of 4 (20 divided by 5.)

If we want this to be random, we can use the value as the ID for a random value node. While the mapped range doesn't change, neither will the random output. Once the mapped range changes, the random output will change unpredictably:

enter image description here

Here, I'm driving the whole thing from my frame count, but I could drive it from something else instead. For example, we could drive it from your pre-wrap Z translation if that's more convenient.

$\endgroup$
1
  • $\begingroup$ Thanks. I'm playing with it, but so far my individual instances aren't getting affected separately. They're all moving together by the same distance. $\endgroup$
    – Mentalist
    Commented May 30, 2022 at 5:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .