# Geometry Nodes: Creating a random object picker with Rarity

Im trying to use Geo Nodes for the first time to randomize accessories but I feel like its way too random.
Is there a way to make certain objects rare or have a gradient of rarity so the Yellow Torus shows up much less?

I basically made it so that the location randomizes the accessory.
Had to use a Vert as a point because I don’t know how else to have an accessory spawn on Suzanne’s Origin.

Every time I duplicate Suzanne and move, the accessory is randomized because I want to animate a camera to render each one down the line.

I don’t know enough to make some sort of Rarity curve, a percentage or somehow introduce rarity so that certain accessories show up less to the point only 1 might show up.

You can do it like this, but it will get cumbersome if you have a lot of accessories.

What you can do instead is this here, actually using a curve, but you will have to know how to shape it, as it does not define the relative chances of the individual accessories, but the inverse of the normalized accumulated chances (if I recall my stochastic lectures accurately):

instance_rarity.blend (139.5 KB)

2 Likes

Thanks that works!
I tested it on a red-colored icosphere and managed to get it to show up only once, I’ll have to fiddle with the curve some more caus it’s real weird lol.

If I may bother you once more, I noticed there are Material Index Geo Nodes but I couldn’t figure out how to have it randomize the material if I have 7 materials on the Suzanne, couldn’t find any tutorials about material index changing either, all it seems to do is change random faces on the models themselves so I think it has to somehow understand it needs to be each instance and not faces.

This may help:

Well this is the same issue with every tutorial, it only changes per face
I need different materials on each Suzanne, if that’s possible with the current Geo Nodes, if not I’m guessing the workaround is having a collection with different Suzanne’s.

Yeah you’re right, I only checked it with a simple plane (that only has one face…).

What you can do, however, is

1. add a realize instance node
2. divide the ID by the number of faces of the base instance, round down to the nearest integer, and
3. plug this into the random value node.

This will only work if all the instances you want to apply a random material to have the same number of faces, though. Otherwise, you will have to use your workaround, I guess:

instance_rarity_colors.blend (156.4 KB)

Using your ID Divide method I somehow figured out a way to randomize the Material ID of 6 Materials

I did mess with the Switch node a bit since it has a Material option but if you have many materials it would be cumbersome.

2 Likes