How can I switch between two geometries per point using an integer attribute in Geometry Nodes?

Hello Blender friends,

I have been trying to work on using geometry node to switch between two objects using a named attribute in my csv file.

Specifically, I have a CSV with an integer attribute called is_PTO, which has a value of either 0 or 1 for each point.

I would like to use this attribute to choose between two different geometries for each point (for example, a sphere when is_PTO = 0 and a cylinder when is_PTO = 1).

I tried using a Named Attribute → Equal/Compare → Geometry Switch. The Switch works when I use a constant Boolean value, but once I connect the point attribute to the comparison, Blender reports an invalid link.

What is the appropriate Geometry Nodes setup for selecting or instancing different geometry per point based on the named attribute?

I’ve attached a small dummy CSV that reproduces the structure of my data. Thanks so much for your help in advance!

Many more thanks,

Evan

test.blend (573.4 KB)

dummy_blender_attribute_data.csv (1.1 KB)

You may have a look into Docs-Blender Manual: geometry nodes → fields .. then here are some “things” to consider

  • your is_PTO attribute is already a boolean so you can use it directly..
  • you might put the “to be switched” geometry into a collection and pick some instance
  • because you have only those two this already is the instance index to pick..

Alternatively, instead of collection, we can combine input geometries into instances (the order defines the indices):

This tree doesn’t seem correct though :sweat_smile:
You need to use Instance Index input to pick instances based on integer value assigned to the points. And simply check Pick Instance for it to work. Don’t touch selection, because it will exclude points with 0 value completely.

There can be no geometry fields, it’s a deliberate design choice. Make sure to use the search function

Thanks so much Okidoki.

Thanks so much stray. I eventually go with this sol. Thanks again!

Use Split to Instances and feed in your is_PTO as the Group ID.

Good luck.

The reason you are getting that red invalid link is that the Switch node set to Geometry cannot evaluate field data. Geometry streams exist as whole data containers rather than per-element fields, so you cannot branch entire geometry flows using a per-point attribute.

The standard, performant way to handle per-point variation in Blender is through the instance indexing pipeline. You don’t actually need the Switch or the Equal node at all, especially since your is_PTO attribute is already clean integer data with values of 0 and 1.

To set it up, grab your two source objects from the Object Info nodes and feed both of them into a Geometry to Instance node. This bundles them into a list where the first input is index 0 (your sphere) and the second is index 1 (your cylinder).

Connect the output of Geometry to Instance into the Instance socket of your Instance on Points node. Inside Instance on Points, make sure to check the Pick Instance box. This instructs Blender to treat the incoming geometry as an indexed list rather than instancing the entire combined set onto every single point.

Now all you have to do is take the attribute output from your Named Attribute node (is_PTO set to Integer) and plug it directly into the Instance Index input on the Instance on Points node. Every point with a value of 0 will spawn the sphere, and every point with a value of 1 will spawn the cylinder without breaking the field flow.

Thanks so much for the explanation. I now understand the magic!