Setting Color Offset per Object in a Geometry Node Array

Setting Color Offset per Object in a Geometry Node Array

I’m continuing from the previous post, where I created an array of objects with a rotation offset. Today, I’ve been learning how to set unique color offsets for each object in the array using Geometry Nodes and the Shader Editor in Blender.

In short, this entails using the Index node, normalizing its values with a Math node, and storing them as 'color_offset' using the Store Named Attribute node. In the Shader, you access 'color_offset' using the Attribute node, pass it through a Color Ramp, and connect it to the material.

Pass Normalized Index Values to color_offset variable

In the Geometry Nodes:

  1. Add a Math node set to Divide.
  2. Add a Store Named Attribute node.
  3. Connect Index to the Math node.
  4. Divide by the number of objects in the array to normalize values (0–1).
  5. Connect the result to the Store Named Attribute node.
  6. Select Vector as the data type.
  7. Select Instance as the domain (this is key for it to work in the Shader Editor).
  8. Name the attribute color_offset (or any name you’ll use in the shader).

This setup offsets each object based on its index, normalizes the values between 0 and 1, and passes them to the <strong>color_offset</strong> variable. Make sure to use the Instance domain, as we’re working with instances of objects.

You should have the following set of nodes with these values:

Pass color_offset Values to the Material

In the Shader Editor:

  1. Click the object to edit its assigned material.
  2. Add an Attribute node.
  3. Add a Color Ramp node.
  4. In the Attribute node, set the domain to Instancer.
  5. Set the name to color_offset.
  6. Connect the output Vector to the Fac (factor) input of the Color Ramp node.
  7. Connect the output of the Color Ramp to the Base Color of the Principled BSDF node.

The Attribute node reads the <strong>color_offset</strong> values from the Geometry Nodes setup and passes them into the Color Ramp to assign unique colors per object.

You should have the following shader nodes with these values:

Here’s how it looks: