I tried to assign different random colors to instances based on this answer, but for some reason each triangle of my instancer mesh produces different color for the instances.

Instance Attribute colors vary depending on the face triangle the instances spawn from

Each face triangle of the mesh is producing different results. If using a ColorRamp it's easy to see that the position on the ramp gradient varies greatly from one tri to another. Ideally, the ColorRamp gradient position should fall randomly for each instance, with an equal likelihood of landing anywhere between values 0.0 and 1.0.

Here's another example, with different mesh geometry, different Density Max value, and a standard grayscale ColorRamp (Emission Shader is used in this example, these are not shadows):

Why is this happening, and how can I get the distribution of my random colors to be uniform? Thanks.


1 Answer 1


Use random value instead of index:

enter image description here

  • $\begingroup$ Perfect, thanks so much! $\endgroup$
    – Mentalist
    Commented Jul 29, 2022 at 9:56

You must log in to answer this question.

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