Geometry nodes: choose a random mesh

I’m building a random cartoon face generator in geometry nodes.
Is it possible to let the value dictate what shape is used?

A bit like an IF-statement. If value is 0 use shape 0, if value is 1 use shape 1.

You can use a switch boolean and match a fame number like this.

Hope that helps

1 Like

The switch node is very powerful for doing this just as @AlphaChannel suggested.
I have a setup similar to a nested if-else if - else statement for when I’m trying to select any number of shapes beyond just 2.
In the attached video I’m trying to select 6 different shapes based on an integer value. if a value is above zero that’s treated as True if it’s zero or less then it’s treated as False. So I subtract 1 from consecutive values and use that as the boolean of the next switch node.
At the end of the video, you can also see how easy it is to extend the selection to 7 shapes in this case. This can also be made into a node group. When Geometry nodes finally get support for a looping construct this can be made into a dynamic group easily.

blendfile: selecting geometry.blend (941.3 KB)

2 Likes

Thanks for all the help everyone!