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 geometry
-
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$– ArtichokeNov 25, 2021 at 17:44
-
1$\begingroup$ In the shader use Geometry -> Random Per Island $\endgroup$– Allen SimpsonNov 25, 2021 at 21:23
-
1$\begingroup$ Is number of vertices equal for all objects? $\endgroup$– HarisreedharNov 26, 2021 at 4:13
-
$\begingroup$ Yes because all of them use a same geometry to make instances $\endgroup$– milad shiraliNov 26, 2021 at 9:59
1 Answer
For instanced geometry, you can use Random
value from Object Info
node in the shader editor.
If you want to realize instances or do it from geometry nodes, This setup lets you create random color per object using color ramp.
Replace Attribute
input of last Transfer Attribute
node with Random Value
for randomization.
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.
-
$\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
-