Texture deformation on landscapes

I’m new to Unreal and am learning the engine by attempting to build a nice looking landscape. I’ve done the Zbrush and World Machine stuff, and have a nice height map, splat map, macro colour and normal maps, and a set of tiling textures to use. I generated my landscape in Unreal using my world machine height map and made a simple shader which combines my tiled textures and splat map using a Layer Blend node. It should be a good basis to build on, except I have one big problem - Unreal is planar mapping the landscape, so the more vertical a surface gets, the more distorted the texture becomes.

My UVs come from a Landscape CoOrds node, which I guess is the cause of the problem. Is there any way to correct for this, and so allow cliff edges and steep mountain sides to have aspect correct texturing?

Thanks!

Looking at the nice hang glider demo which comes with Unreal, there is no deformation on the landscape Epic supply. The material used on this landscape is astoundingly complex, and far beyond my beginner level Unreal skills. It does however work as a landscape shader should, and allow surfaces of any angle with no deformation in the texture. It doesn’t use any of the standard Landscape Layer Blend techniques used in every Landscape tutorial, and Epic themselves have never explained it, other than to mention it in a Twitch stream and say “it’s complex”.

So in short, I’d like a nice easy way to stop landscape textures being distorted on steep bits of terrain. Surely there must be a way to do this which doesn’t require a gigantic shader network with no tutorial to explain how such a thing is constructed?

Thanks! That did the trick. I had to use a Texture Object instead of a Texture Sample to get it to work, but other than a bit of fiddling with the settings, it works very nicely.

It’s too bad this isn’t the way LandscapeCoOrds works!

Glad to hear! Show us a shot of it in action!

I know what you mean- I’m not entirely sure what the different mapping types in the landscape coords expression even do. I should play with it a little.

I’m still incredibly early with this scene, I plan to cover up a good chunk of it with 3D rock assets, as well as trees and buildings. Plus I’ll blend in many more textures if I can ever get that working…! It’s a start though!

Looks great man!

If you post your material setup I can show you how to get more layers blended.

Thanks, I have big plans for this scene so this is just the tiniest tip of a giant iceberg. I still have a lot of things to learn first though.

I’ve been trying to hand paint my existing layers onto the landscape, but so far it’s been a total failure. I made a thread to ask about this but so far nothing I’ve tried has worked. Here’s the thread I made - Painting landscapes - Rendering - Epic Developer Community Forums

Ideally I’d like to be able to add more layers so that I can hand paint in much more variety and go far beyond the limits of my 4 channel splat map.

Frankly your setup is a little bizarre- you are running your splat map as a mask through the heightmap layer in your Layer Blend and then using what I assume is the same scale as your landscape. That won’t allow you to paint anything new. Normally you’d tile the height layer to the same scaling as your diffuse to achieve this effect on a smaller scale:

I would suggest trying this approach- it will let you import the splatmap as a weight map and now you can paint over it/replace it, etc.

I set my material up based on a YouTube tutorial I found (- YouTube). I also found a bunch of other YouTube tutorials which used the same method. I spent a little time yesterday looking at doing this via multiple maps (my splat map torn apart into 4 different greyscale maps) in the layer section of the Landscape editor, and it worked. Clearly I was going about it the wrong way, - someone needs to make a YouTube tutorial (preferably Epic themselves!) on how to do this the right way.

Thanks for the insights, now I want to figure out how to get displacement working, so my rocky landscape surfaces can get some shape, and how to get detail mapping working. Are both of those things possible with the UE4 landscape system?

Continuing to experiment with using separate landscape masks in the landscape later tool, I’m getting black areas all over my landscape if I use height blending. If I set even a single layer to use height rather than alpha blending, then I get black holes all over the place. The fix on the Epic wiki is to set one layer to alpha, but that doesn’t fix it for me. Only setting every layer to alpha makes any difference, but in doing that, I lose my nice looking height blends.

Another problem - when I try to add normal maps (using a Layer Blend node) it breaks the shader completely, so all I get is the default checkerboard. No idea how to fix this one either.

This landscape system is riddled with class A bugs.

The issue appears to be with combining a macro texture, such a normal map or colour map over the landscape using a standard Landscape Coords node set to the same scale as the landscape. I’m using a BlendAngleCorrectedNormals and a MultiplyAdd to blend the macro normal and macro colour respectively. With either plugged in, the entire shader dies.

Can anyone help with this please? This should be so simple to set-up, but with no Epic tutorials and a mountain load of bugs to work around, this is anything but easy.

First problem: Not sure if this will help but with setting only one layer to alpha, first paint it across the entire landscape, then paint in your height blend layers, see if that helps. I always have my base layer set to alpha and fill with it and have no problems. If you still have black showing up then there may be something wrong with the material.

Second: Sounds like you might be running into the texture sampler limit, if it’s checkerboarding when you try to plug in a new texture. Try switching your sampler source from “from texture asset” to “shared:wrap” on the textures already in your material, and then add your new textures. Note that this is only supported in DX11 so you’ll need a feature switch inside your material to turn off your extra textures if you want to support DX9 for your project.

I flood filled my landscape when I first started the scene, as I had seen that was a workaround for this particular bug. No luck though, I still ended up with black splots.

I just gave the shared:wrap thing a shot and it worked. Thanks! Hard to believe that a landscape using only four layers is already at some sort of shader limit though. That doesn’t bode well at all. Also bizarre that the engine doesn’t tell the user what the problem is and how to fix it, it just displays a checkerboard with no error message. Helpful.

I had planned to add displacement and detail mapping to my shader, but I guess if I’m already at the limit that isn’t going to happen!

Have you used all the alpha channels in the textures you are using? You can also put maps in your blue channel normal maps. I know people here have posted that setup before.

It takes a lot of time and creativity to create a landscape material. There are a lot of conditions and restrictions, that’s the nature of the beast. I will say once you lay the blame on the engine, you’ll stop trying to find solutions. I would suggest stepping back, working on another task and then you might gain new perspective on the problem.