1

I have a set of geometries that they're generated by "Instance on points" Now i need to set a Color Ramp attribute for these geos to set a rainbow like material to these geos In fact, i need make an attribute for these geos to set a different color (by color ramp) to every geometryenter image description here

1 Answers1

3

For instanced geometry, you can use Random value from Object Info node in the shader editor.

enter image description here

If you want to realize instances or do it from geometry nodes, This setup lets you create random color per object using color ramp.

enter image description here

Replace Attribute input of last Transfer Attribute node with Random Value for randomization.

enter image description here

Note that it only works if all objects have same number of vertices.

Update:

There is a better solution to this problem by Robin Betts idea of scaling instances to 0 and transferring attribute. Which even works with objects having different number of vertices.

enter image description here

Harisreedhar
  • 3,054
  • 7
  • 11
  • Thanks a lot for your correct and proper answer. Now I have another question; In Blender 3.1 Alpha, it seems like this problem has solved In fact, in the Attribute Transfer Node, they've added an option to transfer Instanced Geometry Indexes as an Attribute, but there is a problem when the attribute is transferred to Shading Node Space, Color ramp doesn't works, even after normalizing Attribute to capture 0 to 1 Value. In fact, The attribute value in Geometry Node is showing up a set of value between 0 to 1, but these values haven't any effect in Shading Space. – milad shirali Nov 28 '21 at 07:26
  • 1
    May be that is not supported by shader nodes yet. – Harisreedhar Nov 28 '21 at 11:25
  • +1 great...how did you find out that!?!? – Chris Dec 04 '21 at 09:06