Hi, I am working on a project with 200 vertical wood slats (6"Dx2"Wx10’H) which are all in a line several inches away from eachother, all with the same UV template. Im wondering if theres a way for a material to be placed on all 200 which will random the textures direction, like pan it up/right/left or down from a range of 1’-10’ to avoid texture tiling when compared to the one next to it. Right now the same material is applied to all and I will have to create a duplicate material shifting the texture over several feet and then manually place it on 100 of the slats but this is time consuming. Any thoughts on an automatic solution?

Lots of options - 1 idea - shift uv coordinates based on world space

You can build your own pseudorandom number generator by just taking ObjectPosition and multiplying by some non-grid number and taking frac. Then do it again using different numbers and append to make a V2.

Here is one example

This line makes a random float which can be your X offset

frac ((ObjectPosition.X * 69.321) + ((ObjectPosition.Y + 137) * 23.112))

Then do another one to make your Y offset just by changing the numbers

frac ((ObjectPosition.X * 77.686) + ((ObjectPosition.Y + 69) * 37.585))

I didn’t actually test so you may need to mess with the numbers a bit to remove patterns.

You can also use the custom node with this single line:

PseudoRandom(x);

Just make an input x where x is a v2. To get a random v2 from it you could do:

float2 outval = 0;

outval.x = PseudoRandom(x);

outval.y = PseudoRandom((x + 137) * 6.18);

return outval;

of course you will want to play with the numbers I randomly chose.

Ryan thanks for the response, here is my first stab at it. I used your numbers for the sake of showing where I am plugging what into where. Not too sure hot to plug both offsets into a node to work with the UV coordinates, right now it is forcing the material to read as black. Any thoughts?

don’t append it to the texture coordinates but just add it before feeding it into the texture’s UVs

This is the setup with an add node as opposed to an append, same black result.

You forgot to use component masks on ObjectPosition X and Y for the top any bottom respectively so you are trying to add a V4 to a V2. That should actually give a compiler error so I am not sure why it didn’t.

Works perfectly now!! Thanks so much Ryan.