5
$\begingroup$

UPDATE: So I have tried to follow the insctructions posted in the comments but ran into the problem that Blender 3.1 doesn't seem to have "Duplicate Elements"-node. I am still running into the problem that I can't randomize the socket for "count" in the "Mesh Line"-node.

Any ideas would be greatly appreciated!

enter image description here enter image description here

OLD POST:

I have been stuck for the whole afternoon now and I hope that someone has a clue how to solve my problem.

I want the number of vertices to go up with the scale of a mesh object generated in geometry nodes. Application: the cube scales on the z axis, is suppsed to be a building and with each step of scaling, one addition vertex on the Z-axis should be added.

When setting the vertices count as fixed, the result is fine.

But once I take a random integer value between 1 and 5 and add another integer value and connect this into the vertices count of the mesh, Blender states that the value is supposed to be at least 1. enter image description here As you can see, the result of the math operation "add" should always return an integer greater than 12 in this case.

But I keep getting this error. I habe already tried to add a "Float to Integer" after the math node. Doesn't help either.

Any suggestions? Your help is very much appreciated!

$\endgroup$
1
  • $\begingroup$ in Random Value node try to connect a value to your ID input, this will give you the stable random values you need for this property... $\endgroup$
    – alambre
    Commented Mar 24, 2022 at 18:44

1 Answer 1

8
$\begingroup$

The real is problem is not that you need an integer instead of a float, but that the Random Value node's output is a field (diamond-shaped socket), whereas the Cube node only accepts a single value (circular socket). A field means that a number is not decided ahead of time, but produced dynamically in response to a context. Cube is not designed to change its number of vertices dynamically based on context, it (like all other "primitive" objects available in GeoNodes) is meant to be a static object, with set parameters. Now, you can force the Random Value node to give you a single value, by providing it with a context (in this case, and ID number), like this:

enter image description here

There is a problem though: it is giving you a random number (here, 4.xxx), but from this point onward, that number will always be the same. It won't change dynamically based on context, because its context is fixed (ID:22). If you were to distribute this cube, by instancing it on a line for instance, all cubes would have the same amount of vertices. That number would have been determined "randomly" at the start, but it wouldn't change with each copy:

enter image description here

In that case you'd need to follow another strategy. Instead of trying to vary the number of vertices of your cubes and use them as whole buildings, duplicating them in the Z direction a random number of times as flats of your buildings, for example:

enter image description here

$\endgroup$
5
  • $\begingroup$ Thanks a ton for this very detailed explanation! I now know that I tackled this completely wrong from the start - not knowing of these limitations. I will now rethinkg this with the guidance you have given and build a new node tree. Again, thanks a ton! That has been rather frustrating tonight! $\endgroup$ Commented Mar 24, 2022 at 19:43
  • $\begingroup$ Well, unfortunately, it doesn't seem to work that way in Blender 3.1 anymore, since the "duplicate elements" node is missing. I tried to find an alternative way but ran into the same diamond-shape vs. round-shape problem. Will post pictures in and edited version of my post. $\endgroup$ Commented Mar 24, 2022 at 20:25
  • $\begingroup$ Ah, sorry, Duplicate Elements is actually a new node. I use 3.2 Alpha. It was just an example so I didn't think to warn about that. $\endgroup$
    – Kuboå
    Commented Mar 24, 2022 at 20:29
  • $\begingroup$ Will load the Alpha then :-) $\endgroup$ Commented Mar 24, 2022 at 20:34
  • $\begingroup$ Here's a stream video where Johnny Matthews (the developer of the Duplicate Elements and many other nodes) himself explains and plays with the node: youtube.com/watch?v=iefeY2lRSO8 He also has other Geometry Nodes 101-style videos where he goes through the basics, so check him out. $\endgroup$
    – Kuboå
    Commented Mar 24, 2022 at 20:36

You must log in to answer this question.

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