How to randomly pick texture from sequence of images

I have an array of cards as shown in the attachment.

How do I make blender pick textures from a folder and randomly apply it to the cards? So that each card looks different from the other.

Any help would be much appreciated!

You can’t make it select randomly from folder, not to my knowledge using nodes anyway.
But if you name the files (and make them equal size?), you can use Geometry/Random Per Island through a map range/stepped -> math/greater than, and string together a bunch of image sequences with an offset in each. I’d improve the stuff below with some set index and so on, but you get the idea:

Alternatively I’d set up the images in a single row multi column lookup and just offset the coordinate lookup.

Wouldn’t that possibly lead to duplicate cards?

Yes. I thought you wanted randomly. If it’s based on an array modifier with fixed distance, you can use the position data to create the selection. If you want a whole bunch of cards with different image, that’s gonna get messy quick.
Maybe apply the array, separate to objects, rename the objects based on card id, then get help from script gurus to create the materials automatically, doing the rest in a node group that applies to all.
Maybe store all images in one lookup image side by side, then use a collapsed UV to indicate which one to use for which card?

I’d try the lookup image and offset the texture coordinates based on object ID.
Then either assign IDs randomly by hand or with a simple script.

I had a go with it, I just picked an image on the web with columns and rows of cards in it. This is the setup I ended up with - choose to use random per island or object index.

If this was for real I would have picked a good image and cropped it up properly.

1 Like