Good transition between materials!

Hi! I am making a game with terrain, but I don’t want to make a huge terrain texture, so I just use 2 materials on it(sand and grass). Anyway, the transition btween theese materials is very, very sharp. Is there any way to make it smooth? I tried to texture materials in Vertex paint, but unsuccessful.

You can accomplish this by using stencil texture.
I tried to find a good tutorial, but it was easier to just whip up a blend.

Here

The way it’s set up, you should be able to ‘paint’ dirt over the grass. What you’re actually doing is painting the masking texture, and the dirt texture below it is only showing up where the mask is painted.
The ‘visual’ textures can be mapped/tiled however you like, but the mask texture should cover the entirety of the terrain in one big map. You can get away with making these pretty low-res though.

Thanks, but how to mix in 5 textures(rock, grass, gravel, clay and sand)?

The most immediate way would be to make a 2nd/3rd/4th mask layer, but any textures are going to be masked by every mask layer under it, so that wont work in many situations. You could make a 3rd ‘rock’ layer, but it would only show up over the dirt.

This is sort of how they did it in Halflife 2: Use several different materials, each one a combination of two material types to be blended together. You then map the individual faces with whatever combo of textures you need.
Say you wanted a rocky patch in one corner of the plane in the example blend. You can subdivide the plane, resize if needed so that the plane is straight grass with no dirt, and apply a new material to that face, exactly like the other one but with ‘rock’ instead of ‘dirt’ and keeping ‘grass’ as the base layer.

It does have its limits but its the best way I can think of.

I’d use vertex color and a node material to mix them:

black = dirt
green = grass
blue = gravel
red = clay
white = sand

Node materials are amazing things.

The vertex color made the grass just solid green, but sand was normal- I found the way using stencil for multiple materials…

Hey sdfgeoff, how would look that node system? I have not been able to use more than 3 colors to mix textures: red, green, blue.

With three colors you can mix for textures in, as black will be ‘no texture’ so you simply have three mix nodes.
To get the fifth color you have to do some trickery. Get the overal lightness of the vertex (adding the 3 values), do some math and use that to determine the final mix value.

Because you’re summing the values any single (or combination) of two textures will transition nicely, but as soon as you have three, the fifth texture will appear slightly.

If you want more, you can use the second vertex color layer. (From memory only the first two work in the game engine?)