How can I control the density or probability of an object based on material using geometry nodes?

I'm new to blender. I'm wondering using the attached node layout, where I use multiple 'set materials' how I would be able to control the probability of one of these materials appearing. Specifically the material 'sticker.oo1'.

You can use this node setup...

to get this:

Note1: i changed your sticker color of 001 to pink so that i could see something - in your blend file it was just black

Note2: important that this works: you have to make sure, that your material 001 goes first into the instance node like this:

The node setup is pretty basic: a probabilty will be defined by boolean random value. This controls a switch whether it uses instance 0 (integer node 0) or a random value from 1 to 7 (which are the other instances)

• Perfect. Thanks very much for your help I'll remember this! Commented Jul 13, 2023 at 9:58

I figured, it might be convenient to have an interface like so:

Here 🟦 Blue material has the same chance to appear as ⬛ Black. 🟩 Green has twice the base chance, meaning it statistically appears as often as Black and Blue combined. 🟥 Red will fill just a quarter of the area Green fills, and ⬜ White is very rare, 5 times rarer than Red. The probability could be presented as a chart:

🟦🟦🟦🟦🟦🟦🟦🟦🟦🟦⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟥🟥🟥🟥🟥⬜

Of course if those cumulative weights are confusing, feel free to just set the values to percentages, in this case it would be: 🟦$$22\%$$$$22\%$$🟩$$44\%$$🟥$$10\%$$$$2\%$$ (some arbitrary rounding was done)

The real result of the above:

Obviously other than provided Seed, it would be nice to allow for some grouping, where you would plug in a Mesh Island: Island Index for example. I'll leave it for anyone interested to edit in, as basically you would just plug it into the ID of the Random node (select the node and press ✲ CtrlH to reveal hidden sockets).

Randomize Materials group:

• Reading the question again, I might have misunderstood the question (or I did understand it but the title is bad), might need to find a better place for this answer :P Commented Jul 13, 2023 at 10:22
• Thanks for your input. Looks interesting I'll play around with your settings when I get home. Commented Jul 19, 2023 at 14:15