1
$\begingroup$

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

$\endgroup$
4
  • 1
    $\begingroup$ I think that, because the instances share the data, all of them share the same material properties. The only way that I know to do that is making the instances real. $\endgroup$
    – Artichoke
    Nov 25, 2021 at 17:44
  • 1
    $\begingroup$ In the shader use Geometry -> Random Per Island $\endgroup$ Nov 25, 2021 at 21:23
  • 1
    $\begingroup$ Is number of vertices equal for all objects? $\endgroup$ Nov 26, 2021 at 4:13
  • $\begingroup$ Yes because all of them use a same geometry to make instances $\endgroup$ Nov 26, 2021 at 9:59

1 Answer 1

3
$\begingroup$

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

$\endgroup$
3
  • $\begingroup$ 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. $\endgroup$ Nov 28, 2021 at 7:26
  • 1
    $\begingroup$ May be that is not supported by shader nodes yet. $\endgroup$ Nov 28, 2021 at 11:25
  • $\begingroup$ +1 great...how did you find out that!?!? $\endgroup$
    – Chris
    Dec 4, 2021 at 9:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .