Sequentially iterating through objects in a collection using Blender Geometry Nodes

Using the Collection Info node in Blender Geometry Nodes, we can access any object located in a specific collection. By accessing objects in a collection by index, we can easily change the current displayed object, simulating a sequential object scrolling.

Let’s create a collection and add several objects to it (shift + a – Mesh – …). Hide the collection and all the objects in it from being displayed on the viewport screen by clicking on the “eye” icon in the Outliner.

Separately, let’s add a cube to the scene, assign the Geometry Nodes modifier to it and create an initial node tree.

We will not need the original geometry of the cube. Let’s replace it with one point. To do this, add the Points node (shift + a – Point – Points) and switch the main branch of the node tree geometry to it. The number of points in the “Count” field will be left as default (one).

To gain access to collection objects, add a Collection Info node (shift + a – Input – Scene – Collection Info). Set the collection we created earlier in the “Collection” field. Check both the “Separate Children” and “Reset Children” checkboxes.

Add an Instance on Points node (shift + a – Instances – Instances on Points) to the main geometry branch of the node tree. Check the “Pick Instances” checkbox. Link the “Instances” output of the Collection Info node with the “Instances” input of the Instances on Points node.

Objects from our collection will be placed as instances in place of the point from the Points node now.

To iterate through objects, we will simply change the index of the currently displayed object from the collection.

Add an Index node (shift + a – Geometry – Read – Index). Also add a Math node (shift + a – Utilities – Math – Math), leaving it in the “Add” mode. Link the “Index” output of the Index node with the “A” input of the Add (Math) node. Link the “Value” output of the Add node with the “Instance Index” input of the Instance on Points node.

By scrolling the value in field “B” of the Add node, we see how the current displayed object from the collection changes sequentially.

To change the integer values of the object index, add an Integer node (shift + a – Input – Constant – Integer) and link its output to input “B” of the Add node.

Now we can conveniently iterate through objects from the collection sequentially by index.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comment
Newest
Oldest Most Voted
Inline Feedbacks
View all comments