Material blending transition masking - how ?

I figured I can use 3 or 4 way vertex color to blend several textures on my mesh-based terrain ( ). However, the transition between textures is just a smooth gradient. How can I break it up with some masks ? Something similar to this article:

Would it be performance oriented way of blending textures for a mobile platform or should I use some other way of blending textures or should I not even bother with blending textures on mobile at all?


P.S. I don’t think I can use landscape material due to performance reasons, but even if I could, the tutorials don’t have any info about transition masking.

You can check Math_Hall map from Content Examples. There is a stand 1.9 (Height Lerp) which shows how to do similar transition.

I don’t believe that’s the thing.

This is an example from gamasutra article that no one will read (or so it seems :stuck_out_tongue: ):

What UE4 does by default when using vertex color blending:


This is what it should be:


These 2 textures are on a flat horizontal plane, no height difference (the transition is not defined by slope or heightmap). In other engines either alpha channel would contain mask or it would be a separate image. The mask, to put it simply, is a gray image where stones are white and gaps/cracks are black. So not only sand transitions to stones based on vertex color, it also takes into consideration that mask. So instead of plain smooth gradient transition, you get natural transition where sand goes over stones, then gets into the gaps between and finally it’s just stones.

How can I do that in UE4? :o

Did you actually check example I mentioned? It does exactly that kind of transition. And this effect is actually driven by depth or height map, as written in the article:

You will need to adjust the transition alpha that you get from vertex color based on depth maps of the textures.

Sorry, at work now, but I looked into docs: “The HeightLerp function allows you perform a linear interpolation between 2 textures based on a heightmap and a transition phase value.” So I thought it’s elevation based.

I’ll look into content samples, thanks.

Alright, I am back with this and I am not sure how to combine vertex color blending with HeightLerp :confused:

This is HeightLerp basic setup:


I have 4-way blending going on using vertex color and I need to use HeightLerp only on the transition area between 2 textures. How do I combine the two methods ? Do I just feed vertex color to transition phase socket?


Bam! (not mine)

I did this ( in 4.8 I think, hope it still works) when I played with vertex painting and heightlerp on “stones” with moss and flowing water. (Think I only used textures from starer content.)
Maybe it can be to some help.