Lets say you have an array with 6 objects, can you give them 6 separate colors?
It’s been some time since i used Cycles but i thought you could do something like in my screenshot for this.
But i can’t get it right.
I’ve tested apply the array and separate by loose parts but the only thing i seem to get different colors with is from the random output and that doesn’t produce the six colors or in the order the colors are setup.
I want the six objects to have the exact six different colors in the right order.
Hi,
Not quite sure it’s OK.
The objective is to map the UV coordinate to the color ramp.
from 0 to 1: we want 0.5/6 /* first color /
from 1 to 2: we want 1.5/6 / second color */
…
from 5 to 6: we want 5.5/6
from 6 to 7: we want 0.5/6
from 7 to 8: we want 1.5/6
…
so the formula is: ((trunc(UV) modulo 6)+0.5) / 6
the function trunc(UV) does not exist so I used the value minus the (value modulo 1). (for example 2.23 gives 2.23 - 0.23 = 2)
The mapping node is useless.
Could say that but that’s why it doesn’t work. Array modifier does not array objects, it arrays object data (mesh). You have 1 object with 6 mesh parts, that object gets one object index (probably default 0) and dividing 0 with 0.6 gives 0, which is the first color in the ramp.
To add to other answers, could also do this with procedural duplication. Instead of arraying (mesh) this uses instances of objects and it’s possible to use parent’s coordinates to get a single color for each.
Duplifaces are used. Basically single planes where duplication puts a cube on each face. Those faces are UV unwrapped.
The material is for one cube and coordinates come from the parent object with the ‘dupli’ option. We’re only interested in U axis of UV coordinates. Top set of cubes uses the shown color ramp, bottom ones use different UV’s from parent and hue saturation node to get a different range of hues with an offset.