6
$\begingroup$

Is it possible to get the array index of an array modifier in the shading editor?

I need to shift the UV of every array segment by a certain amount. I can't apply them because the number of segments keeps changing.

I also can't use the segments position because the segments are places alongside a curve (curve modifier)

Any way with Python? Or drivers?

$\endgroup$
2
  • $\begingroup$ You can simply check a checkbox in the modifier settings under UV section to achieve this effect $\endgroup$
    – sulu00
    Commented Jul 29, 2022 at 19:37
  • $\begingroup$ @sulu00 What checkbox? In the "UVs" section I only have sliders "Offset U" and "V" and that applies same offset to all copies which is useless. $\endgroup$
    – menfon
    Commented Aug 7, 2022 at 17:28

1 Answer 1

3
$\begingroup$

You can specify offset UV in the modifier settings under UVs section to achieve this effect. See the attached picture.

  1. Is the offset, which should be less than one.
  2. Is the UV map that is smaller that the texture.
  3. Shows how copies get the different fragments of the image texture. Each instance has a texture shifted by value specified in 1.

enter image description here

Another example (in case you really need the index in your shader): Use gradient texture, mapped to UV and then use Map Range node with Stepped Linear mode (see picture). This way each instance will have a single number assigned to it. However this requires that all of unwrapped instances fit a single texture. n my case I have 15 instances and each of them has the U offset set to 0.066667. This is also a reason why number of steps is set to 14 - so that I convert the linear gradient into 15 steps, having different color. And each steps fits exactly one UV map instance. enter image description here

$\endgroup$

You must log in to answer this question.

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