How to randomize UV-coordinates?

I am making roof tiles, and I gave each roof tile, say 20 different UV-coordinates of a roof tile texture.

I want it to randomly choose between my 20 different UV-coordinates, and ONLY those 20 UV-coordinates (no others!!!)

How do I achieve this in Cycles?

Can you post a sample file with what you did?

I know a few methods to work with this kind of situation, but none requires more than one or two uvmaps…

I don’t post a .blend file, but what I did was:

  1. Make a roof tile, duplicate it, give it another UV, do this 20 times (see picture):


Eventually, I might give it 20 different UVMaps in Object mode, and seperate them by loose parts.

  1. What I want now, is a shader that randomly choose between my UVMaps and hence, the parts of the texture (that I have specified, in this case, about 20 different parts of the texture) whenever I duplicate a roof tile.
    Preferebly, it should work with array modifier.

I initially tried solving the problem by grouping my roof tiles, and then distributing them using a particle system… problem is, particles are randomly placed, even with even distribution and random off, it still is random. Random enough for this not to work.

Instead of particles, you can use duplis… I’ll try to check what you did (recreating it) and figure a solution out.

I’m not sure if this is what you want, and I expect the math to be broken, but something like this is how I would randomly choose a square (divide muted) or full height (divide on) in a texture map containing 20 variations side by side. If you want to preview the UV map coordinate readout, I recommend switching color management to none (so that 0.5 actually reads out 0.5 instead of gamma corrected). Dupli and manual cloning would work, but not array since that keeps things in the same mesh. So setup looks something like this:



Note that my square things are arranged in 5x4 rather than 20x1 for space utilization.

Here’s the method I normally use:
create one uvmap for all tiles, so that each tile occupies the whole UV area.
create another uvmap, but with all tiles as islands, and then scale the islands to Zero (with individual origin selected).
then you can use the second uvmap to drive a noise for the randomness, and the first for the textures.

an example blend:
http://www.pasteall.org/blend/43006the second

ps: what I really did was:
create one tile, unwrap.
add two array modifiers (X and Y) and apply.
add a new uvmap, and unwrap again.
with uv selection set to islands and pivot to individual origins, scale the islands to 0.
play with the material.
:wink: