Download

Random UV offset for materials?

Is there anyway to randomize the section of UV a mesh uses, or to offset the UV by a random amount?

My goal is to make it so that modular pieces of wall and floor will have variety to them while still using one material. Each mesh would need a different UV value to make this happen. I’m aware of nodes such as world position and object position, but the problem there is that when you line static meshes up the material still flows as normal across them rather than having variety.

Realistically, object position in world space is your only source of more or less reliable pseudo-random. It is a matter of making a good function, that will give you random UV offsets on both directions, even if only one world position axis is changing.

There is a way to set up a Blue Print that makes it so if you have a mesh chain, they will essentially spot pick random areas of a texture sample. In other words, say you have just a normal wood fence you would see in a backyard of a suburban house. There is a way to set up a blue print so that the blue print uses 1 piece of wood, which you are able to drag the distance of your desire, while each mesh piece uses a random part of a texture sample. So you can have 100 boards with non-repeating materials. I am actually trying to re-create this as an old team member did it but got lost and they have since left. If I stumble upon it, I will be sure to post a link or example of it. It all starts with a blue-print though.

I made a neat little random number generator for materials a while ago: Link
note that it basically just takes the object position of each object, and multiplies that by a random number as decided by a simple noise texture. you can then plug this in to a ‘add’ node with a coordinate node to get simple offset amounts for different meshes in world-space.
OR, if your meshes are using the ‘instanced static mesh’ component from a blueprint, then its as simple as using a ‘per instance random’ node :slight_smile: