How do I blend landscape textures based on world height / heightmap values?

I’m currently working on texturing a map that is about 400,000 x 200,000 km in size, as such, it would make sense to build a dynamic texturing system that blends textures based on pre-defined heights and angles (snow textures applied at certain elevations, etc.) I’ve been trying many different methods and none of them seem to work.
I already know how to align textures to angles (rocks on cliffs, grass/dirt on flat land), I plan on merging that with this.

I know there is a way to do this, but UE4 does not seem to have a node for it anymore…

Also, this same question was asked by somebody else here- Is there a way to blend Landscape Layer by both positive and negative heights? - World Creation - Unreal Engine Forums but nobody has answered yet. This is one of the few remaining things I need working for me to really get started on my project, thank you for your time…

World_Aligned_Blend only calculates direction, not actual world-space values. Which is good for blending textures based on slope (rock on cliffs, grass on flat land) but not at all what I’m looking for.

I’ve already managed a partial solution to this myself. The only problem is that currently I have a bounding-box uvw node, where each landscape is composed of many bounding boxes, meaning I’m getting uneven results.

As you can see in the second pic, this configuration stops working at the gridlines, when I plugged world-aligned blend in place of {bounding box based 0-1 uvw} the entire terrain becomes the snow overlay I have plugged into this. Which is by no means what I intended.

What I really need is a node that references either world-space vectors or object-space. Large terrains are composed of multiple bounding boxes, which is why my “solution” is not adequate.

Hi Daverex,

Have you looked through the Stylized Landscape document? It may give you a few ideas.

I hope it help.

Thanks, TJ

We’ve both already looked at that page. It only show how to blend based on terrain angles. Ill repeat my comment and that it probably lies within the mf terrain height lerp

Here is another resource that could be of use.

If it still doesn’t help you figure out a solution please comment back and we’ll see what else we can find.

Thanks, TJ

That node doesnt determine where the textures can be located based on the elevation of the landscape. Im about to get off work and play with some texture functions like the mf terrain height lerp. And im not sure how to use that with the world align blend node. It jacks up when i try to paint on it

There is no further need for this discussion, I believe. I’ve just solved it myself. I’ll post my real solution shortly.

Finally after enough poking around and mental hardship, I’ve come to a solution for blending textures based on elevation.

The “divide” node controls where the blending starts along Z (also -Z, this will duplicate results on both positive and negative values, so make sure you’ve the lowest part of your terrain above 0 if you want to use this for oceans and lakes) For me, I had to set it to divide by 140 to get reasonable results.

Note: my example is not entirely finished, as this elevation blend will later be combined with an angle blend, to more realistically show how snow sits on a mountain. Still wont be perfect, but may be believable.

1 Like

And here’s how it currently looks with my angle-calculations added to the blend. Hopefully this isn’t just beneficial to me, but to everybody having the same problem.

Note: this can also be made into entire biome “Layers” For example, I want a temperate layer, and a desert layer, and painting them dynamically textures the terrain according to pre-defined parameters.

I’m currently cleaning it up, once I’ve got it so that other people can see what the heck I did, I’ll try to post the whole thing.

Woot! Any way i could see your full material set up? And are you able to paint on this with other textures?

I’ll post the material setup once I’m done cleaning it up, haha.

And yes, additional textures can be painted using a [layer blend] node. This setup should be on your first layer, addition textures (or alternative elevation setups like mine) can simply be painted like any other layer. This is necessary, in fact. As this landscape setup only creates a massive, generalized environment, it cannot do much fine detail work, for obvious reasons.

Ive figured something out but i have to divide by 4mil for some reason lol. And im not sure where that Absolute world position node is located? And i dont see any changes by deleting all those multiplyers

The multipliers sharpen the results, which I wanted for my map, you don’t necessarily need them, and there may be a way to replace them with something else.

Simply type WorldPosition, it’s under coordinates. Yours will look a little different than mine.

you did the dot function first, yes? I’m not sure why you need to divide that high. My test map’s landscape was aligned at 0 on Z, btw. If your landscape is below there, you’ll get different results. As they’re present across both the negative and positive values of the Z axis. Also, my test map stretches to the heighest point UE4 will support, which may be why my results don’t need such a large divisor.

You can use Power under math. And plug a vector 3 into the main material nodes World Position Offset input and raise the z value to lower the center of ur material. I have mine now set up where the ocean is at the very bottom of what unreal can do and the snow at the very top. And if u haven’t figured it out already just invert the snow function to create an ocean layer at the bottom. Oh and in order to paint i assume u have to run this through a landscape layer blend? Are you able to do that?

Yes, it’s simple. Instead of plugging a texture into the layer function, just plug this whole setup into the first layer. You can use it the same as you would a single texture, except this already plans out the bulk of the painting. I believe I already mentioned this though?

and yes, I was going to replace the multiply nodes with an exponent function.

You never posted your full final material setup

Sorry about that, I’ve not had much time to work on things until recently. Here is a general overview of what my current material setup looks like, I’ll try to post a more detailed view as well…

Im confused on where to find the “world to local” node?