Preventing Texture Repetition - jgoffeney/Cesium4Unreal GitHub Wiki

Back

This section describes how to keep textures used over large areas from appearing to repeat over and over.

How to HIDE Texture REPETITION in Unreal Engine - UE4 Tutorial

Steps

Use Good Textures.

  • A good texture does not have clear edges or unique internal features (like a rock on grass).
  • The recommendation is to use textures from Quixel Megascans.

Add Macro Variation

This adds shading variations over the region of interest by creating a pseudo random combination of noise textures and scaling the intensity of the color.

  • Open the Gold material from the Unreal starter material.
  • Copy the section labelled as Macro Texture Variation with the nodes connected through to Reduce Macro Contrast into your material.
    • The graph contains three different "noise" textures at low, medium and high frequency which are sampled irregularly, combined and then used as the interpolation parameter to Lerp a vector filled with 0.5.
    • Take your prior input to the material Base Color and instead multiply it with the Lerp output and then connect.

GoldMacro

Before Macro Variation After Macro Variation
TextureMacroBefore TextureMacroAfter

Use Distance Blend

This approach samples each texture for high and low tiling and then interpolates between the two based on the distance and direction of the camera. The result is close the player has the expected high resolution of the texture and then blends with the lower resolution the farther out. This disrupts the edges resulting from basic tiling.

  • Distance Blend
    • Create a Distance Blend node.
    • Parameters
      • Blend Range Result: the range (starting at Start Offset) to perform the blending between the high and low tiled textures
      • Start Offset: the distance from the camera to start blending
    • The output value is used as alpha value for linear interpolation between the textures.

DistanceBlend

  • Texture Coords
    • Add a Tex Coords node if it does not exist.
    • Create two Multiply nodes to scale the texture coordinates.
    • I used values of 100 which is appropriate for my example as the high tiling value and 30 for the low tiling. It seems like a pretty good ratio.

TexCoords

  • Texture Interpolation
    • Add two copies of the texture with one using the high and low tiling texture coordinates as UVs inputs for each.
    • Add a Linear Interpolation node. as A and B inputs using the outputs of the high and low tiling Texture Sample nodes, respectively.
      • A: the high tiled Texture Sample node output
      • B: the low tiled Texture Sample node output
      • Alpha: the Distance Blend node output.
    • The output is the new texture output.

TexInterpolation

Vary Materials

Rather than use a single material for a ground type use a couple such as one for grass and one for dirt. Then use a noise texture to blend them in a semi-random manner.

  • Select two similar materials and add as Texture Samples.
    • Connect the Tex Coord to the UVs parameter for each.
  • From the Starter Content add the texture T_Perlin_Noise_M.
    • Add a Multiply node to scale the Tex Coord for the noise UV inputs to offset the noise application. I used a value of 0.8.
  • Add a Linear Interpolation node.
    • Connect the materials' Texture Samples RGB outputs to the A and B inputs.
    • Connect the noise Texture Sample RGB output to the Alpha output.
    • The output of the Linear Interpolation node is the blended value.
  • Notes
    • I added Multiply nodes prior to the UVs inputs for the second texture to use a slightly different tiling and further remove edges. I used a value of 1.1.

This example expands on the above concepts by doubling the textures to allow for distance blending.

VaryMaterials

Final

The result of applying all the techniques does a good job of removing the appearance of tiling.

FinalTexture