1
$\begingroup$

In geometry nodes I made two layers of cylinders containing two objects: icospheres and cubes. Both objects are added to the two layers through a collection info node:

enter image description here

enter image description here

Blend file: GN - layers test 3.

Currently, the density of the icospheres and cubes is jointly controlled from the distribute points on faces node. How can I control the density of the icospheres and cubes that come from the collection info node separately? I know I can split groups from the collection info node, but then the icospheres and cubes are already mixed.

Update of the blend-file (see my comment @Hulifier below): GN - layers test 5

$\endgroup$

1 Answer 1

3
$\begingroup$

enter image description here

Geometry Nodes:

Geometry Nodes

The total density is the sum of the two densities.

The probability of a point being a sphere is the sphere density divided by the total density.

$$\text{For N Instances}$$

Geometry Nodes n instances

Geometry Nodes Index Density node group

What this does is, first create a mesh line with an edge count equal to the object count in the collection, then it uses the density values to set the length of the edges, while keeping them stacked in a line. With this done, it generates a random with the interval $[0, S]$, with $S$ being the sum of all densities. The random is then used as a vector to get the nearest edge's index, which will be the index for picking an instance.

For every object added to the collection, you will need to add another Index Density Node Group to the node chain and connect the last sum to the Density Max socket of the Distribute Points on Faces Node.

enter image description here

The index of a density doesn't need to be specified since the chain of Index Density Nodes already calculates it, starting with 0 and adding 1 for each node.

You should also rename your objects in the collection since the index of objects inside comes from the alphabetical ordering of their names. That way, adding a new object to the collection will not change the index of the others.

enter image description here

Also, if you rename an object inside the collection, the index order will not update, for updating it, you just drag an objet which is inside the collection to the same collection.

Another thing is that some of the small cyllinders sometimes disappears, this is due to the distance from the bigger objects changing, this can be solved by calculating the distance to the objects before transforming them.

Here the transformation is done to the instances, not the points:

enter image description here

The instances before the transformation are the ones sent to proximity calculation.

Update with using normals

Geometry Nodes update using normals

For using normals of the deformed plane while using the original position to generate points, we capture the normals from the deformed plane to the original, we will also capture the position. Doing this, points are generated in the original mesh, but they hold anonymous attributes with the deformed position and normal, which we then use to set their position and rotation.

enter image description here

enter image description here

$\endgroup$
9
  • $\begingroup$ This works great with two objects! Tnx a lot! :) It seems to get more complicated when there are more than two objects in the same collection, because the boolean is only true or false. Know a way to control it with more than two objects? Or do I have to add them in that case individualy by an object info node? $\endgroup$
    – EwSa
    May 25, 2022 at 19:24
  • $\begingroup$ @EwSa I added to the answer a way to use more than two objects of the collection. $\endgroup$
    – Hulifier
    May 25, 2022 at 22:35
  • $\begingroup$ You are realy amazing!!! I could never ever find this out with the skills I have at this moment. I hope I can solve problems like you for once :) Tnx a lot! $\endgroup$
    – EwSa
    May 26, 2022 at 7:41
  • $\begingroup$ Hope you can help me with one more thing. In the file, you see I use a geometry proximity to delete the litte cylinders in each of the two layers where the floating objects are insterted. The noise of the layers is driven by the "#frame" command. When I start this noise animation, the position of the little cilinders are recalculated around the floating objects and they sometimes disappear, because of the geometry proximity. Also the floating objects are "jumping" around the layer. Is there a way to prevent the "disappearing" and "jumping"? New blend file updated in my post above. $\endgroup$
    – EwSa
    May 26, 2022 at 20:35
  • $\begingroup$ @EwSa Edited the answer with the solution to the proximity problem that was making some instances disappear. Also, the total sum should be connected to the Density Max of the Distribute Points on Faces node, and I forgot to do that, sorry for that. I updated the images and the blend file. Everything seems to be working fine for me now. $\endgroup$
    – Hulifier
    May 26, 2022 at 20:41

You must log in to answer this question.

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