Whenever working with highly detailed terrain textures like rock textures on the terrain, i have to face the problem of highly visible tiling.
Just approving the texture often doesn’t help at all:
Multi-UV Mixing
So i looked for other solutions and found an article about advanced terrain texturing on udn, where multi-uv mixing is shown as one very cheap method of reducing tiling just using a modified shader which mixes one texture at two different UV sizes.
Hacking the original shader and mixing the rock texture with a copy of itself at a scale of 4x reduces the tiling.
Modified shader
Edit the built in shader [or the TerrainReplacement.shader when using “UnityTerrainBump” like in the example above] and find the col-definition of the texture slot you want to use multi uv-mixing with:
// original shader
col += splat_control.b * tex2D (_Splat2, IN.uv_Splat2).rgb;
Where “*-0.25” adds a 4x size with flip to the scaled texture and “*4” just brightens the color as multiplying 2 texture samples results in a darker color. Just play around with those two parameters to find the best solution.
You may also want to desaturate the result which would end up in some more instructions on the col-definitions.
I hope this will help some people to reduce tiling on the terrain and keeping highly detailed textures at the same time.
Only drawback I see is that you cant use textures with regular shapes (bricks, mozaic, roads…). It would need more complicated implementation done on per material bases (impossible on unity, because terrain engine is not material based), or only for some channels of ARGB splat maps (probably possible).
@Demostenes: probably you are right as far as bricks and mozaics are concerned, but i guess that you won’t need better tiling on such textures.
and in fact you can excactly specify which channel uses Multi-UV Mixing and which one doesn’t as each splatmap has its own col-definition in the shader. just have a look at the second picture: the rock textures uses Multi-UV Mixing, the brown ground texture doesn’t.
lars
This doesn’t play well with the “base map” texture that Unity falls back to for distant terrain, but is an otherwise useful technique that also works well on large wall or cliff meshes, etc. I’m not sure if we have access to that terrain base map, but if not then it will never match the tiling, saturation, or luminosity of the rest of the terrain in Unity using this method.
edit: you’ll probably want to make sure that your normal map is still normalised after tiling it over itself like this.
you are absolutely right mingo – unfortunately: it doesn’t work well with the automatically created basemap. and as far as i know there is no possibility to get access to the basemap in order to change it in any way.
for this reason i tend to hide the basemapped distant terrain in the fog…
Tiling of textures on cliffs was irritating me too, spolied some nice landscapes i’d made and although larger rock textures looked good at a distance, up close they were bad.
This is an ideal solution, exactly what I needed to get rid of that problem… thank you.
thanks. i hope this will help you to improve the look of your terrains.
i have just pushed the terrain shaders a bit further, so it now supports better tiling even on textures like grass or sand.
indeed
and it offers much more possibilities if you have just some more texture memory left: think of missapplying the alpha channel to add low frequency disturbance!
[right now it is only a greyscaled/ low contrast/ upscaled version of the the original rgb terrain texture ]
I know that it is not fair but you are saying that is more possibilites how to improve it. Can you prepare better shaders? For the best quality. For me shaders are too hard :(.