Download

Vary material tiling?

Hi guys,

I’ve made a single wooden board I am going to build a planked surface with. I don’t want the material to be applied to each board in the same way - I want the tiling different for each board. What’s the best way to achieve this? Any automated way?

Yes there are ways but not currently an automated one. In fact many of the brick and wooden board materials in the the “Starter Content” set were semi procedurally generated from tiling base textures with techniques like this. We baked them down to flat tiling textures using the editor and reimported them because some of the techniques were really expensive, like procedurally generating the normals from heightmaps based on the UVs with edge weathering. In the future that material function will be hopefully made available but honestly it is kind of a mess right now.

Here is the basic theory behind this technique: first create a UV mosaic which is an index on X,Y representing a whole number (search for function “MosaicUVs” under engine) for each tile on X and Y.
Do some kind of “pseudo random number generation” by multiplying or dividing and adding some crazy randomly chosen large prime numbers to that mosaic. Then you get the frac of those numbers. This should get you a pseudo random offset for each tile.

You can create a stagger pattern by isolating one of the initial index components and multiplying it by some fraction and taking the Sine of that. Then you can multiply that result by 0,1 or 1,0 and add that back into your base UV’s before the mosaicUV function to create a stagger pattern. Don’t forget to multiply the stagger by an scalar before addding to the UVs if you want to control the spread.

Remember that creating large jumps inside of the UV layout causes some serious mip map problems. The engine sees the instant pixel jump and tries to fit a whole mipmap transition across 0 pixels, leading to crazy aliasing outlining effects. The solution is to set the texturesample to MipLevel and drop down a ComputeMipLevel material function that uses a version of the UV’s without all the mosaic offset stuff but at the same relative scale. You have to manually entire the texture size in for X and Y.

The next UE4 release will show part of the setup for that in a new “Math_Hall” level: the creation of round bevel normal maps procedurally using UVs and the pythagorean theorum. The actual semi-procedural texture builder material is at least a few months out. It also has some stuff on mosaics and how things like fmod can create stripes etc. Basically all the building blocks but not the completed function. The actual semi-procedural material stuff is at least a few months out.