How do I blend multiple textures on a mesh?

I have made a custom terrain that simply creates a plane mesh with it’s vertices set according to a heightmap(not in shader!). The reason I do not use the built in Terrain objects is that this approach is faster in my case even though texture blending might be easier on the terrain objects.

Now I want to blend multiple textures according to a reference map, it can be a texture used as an alphamap or any other possible approach that you know of. Note that I would like both diffuse and normalmaps to be applied to the mesh.

I did read up a little on splatmaps but I’m not sure if I can use them on anything other than terrain objects or even how to use them. Are they a possible solution?

A shader can be written to blend multiple textures. The built-in unity terrain shader does this - it reads four textures, and blends them based on the fifth “splat map” texture (which is often called a control texture.) That’s partly why Terrain is special - so the system knows to use this shader, with textures loaded in groups of 4 on multiple passes.

You can get the terrain shader and read the code, or just read up on shaders and control textures in general. The basic idea is colFinal=col1*splatCol.r + col2*splatCol.g ... (where splatCol RGBA adds up to 100%.)

I haven’t seen the new U5 universal shader, so it may have some shortcuts to do this (or not.)