Instances on points using collection info - give objects (indices) a defined probability to be chosen

probably the same issue was addressed somewhere, but I did not succeed in finding a solution.

I don't give a specific file/case because it is a pretty basic question and should work for any similar case.

Situation:

Say we have a collection including objects A, B, and C. Using GeoNodes, we distribute points on faces (say a subdivided plane) and then put instances on points with the collection info as input. We tick "pick instance" to let Blender choose one of the objects A, B, or C for each point.

So far, so good. Now we basically distributed all three objects randomly on the plane. If the number of distributed points is sufficiently high, each of the three objects is equally represented, i.e., object A makes up for 33.3% of all instances, object B for 33.3%, and object C also for 33.3%.

Problem:

Now we want to define that, for example, 80% of the instances should be object A, 10% object B, and 10% object C. How can you do that?

I was playing around a lot and couldn't figure it out. I tried to go for "Instance index" with a random value, i.e., I tried to tell the 'instance on points' node to use 80% index 0 and 20% index 1 and 2.

Any help would be much appreciated.

Thanks for taking the time!

That can be this kind of setting:

Knowing the instances count, you can define thresholds comparing a random value (0 to 100) against 80, 90, or else.

Depending on these comparisons you can output 0, 1 or 2 (in this example with 3 instances).

If your case is different, because you are generating these instances, you can duplicate them with the proper proportion, so that the proportion reflects the probability to have this instance:

If you've many instances, you can also use this solution which may be less accurate but involves less nodes. It maps a random value to a curve and remaps it to 0 to n-1 values if n elements in the collection.

• Thanks a lot! Using 6 objects, the second solution did the trick for me. (Using Object info with 'as instance' ticked instead of each "Geometry"+'Geometry to instance'). However, for my particular case, I had to use pretty large numbers in 'Duplicate Elements' and do 6x 'Object info'+'Duplicate Elements'. So, I wonder if there is a "smoother" solution. I get the first solution for 3 objects. Could this be adjusted for more than 3 objects? Commented Nov 19, 2023 at 19:39
• Using the first solution you can add/chain other "less than" nodes, for instance. Commented Nov 20, 2023 at 6:50
• "...and remaps it to 0 to n-1 values if n elements..." or "...and remaps it to 0 to n values if n+1 elements..." Commented Nov 20, 2023 at 13:47
• @GordonBrinkmann, yes you're right Commented Nov 20, 2023 at 13:57
• Thank you very much, I really appreciate it! Commented Nov 20, 2023 at 18:44