Adding variation to material

Does anyone have any idea on how to do something like this?

A quick overview indicates that they are doing the trick of sampling a texture twice, with different UV scales for each sample, then combining them together. It looks like they sample the floor texture at normal UV and at UV * 4, then multiply again by an arbitrarily-chosen color to try to correct the color which is altered by the multiplication. This technique was discussed somewhat in the old Unreal Engine document about terrain texturing as the Multi-UV mixing technique.

After multi-UV mixing, they then sample another texture, multiply it against the previous result, then they mix this multiply result with the original UV-mixed sample with a mix factor of 0.5

Note that multiplying a texture sample by itself has a tendency to increase the saturation and can potentially reduce the brightness of a texture, hence the constant-color multiplication your linked article performs. Also, while UV-mixing can reduce the occurrence of local repeating patterns, repetition still exists at the level of the larger-scale UV sampling. One way of getting around the color-changing issue is to lerp/mix the multi-UV scale samples, rather than multiply them. For example, here is a texture mult-sampled at 1x and 4x scales then multiplied:

Top left quarter is the base texture at UVx1, top right is UVx4, and bottom half is the result of multiplying them.

Now, here is the same texture with a 1/2 mix rather than a multiply:

You can see that this method preserves the overall coloration of the source texture. This is the method that I perform in my terrain editor; you can see some of the results here. If you choose the scale of your larger UV sample carefully, you can use this trick to hide repetition; just be aware that repetition still exists at that larger scale.


[Repetition still exists at that larger scale] It sure does, I used similar tricks in a realtime terrain painting demo, where you could choose the weights and textures on your brush, but could not avoid the fact that I was still tiling textures in a regular way across the terrain

That was a very detailed answer, @JTippetts! Thank you so much for the attention and sharing the knowledge.