Terrain material Height Lerp and Slope Mask problems

I apologise ahead of time if I can’t quite explain myself or use the wrong terminology, I’ve only been using more advanced functions of the material editor for the last month, so you may need to speak in layman terms

Ok, so optimizing my terrain material today and I figured I’d make use of the Layer Blend node as opposed to using a layer sample paired with a material layer blend node because the upkeep is just insane as you can see here

My current set-up https://i.gyazo.com/3de663ffe63322ba1289a1f09c67a441.png

I’m wanting to be able to make use of height map painting which was easily done using my old method, but now I’m running into issues because I’m using SlopeMask node to draw materials based on a slope vector.
I’ve used a height lerp to be able to mask out heightmap placement and it draws correctly when I preview the node, but for whatever reason when I plug it into the height input it stuffs up my shader and draws the default grid material instead. As you can see in that screen shot it is still being displayed in the preview tab.

When I disconnect the heightmap input everything works as expected https://i.gyazo.com/3ef39d86237bdacce41f2b0f1911f01c.png and still works when I plug in a single heightmap texture, but I’m wanting to draw the heightmaps on the correct angles so this wont work for me.

I’ve spent what feels like an eternity trying to get a decent Landscape material and I really want to get back to programming in blueprints, once this question is solved my spirit will be allowed to cross back over to the light side (no offence to you shader junkies)

Thank you very much, I will forever be in your debt <3

You may be exceeding limit of 16 texture samplers, that is why you are seeing default material. Make sure that samplers are set to shared:wrap.

But generally, I have a feeling you are sort of misusing LandscapeLayerBlend node.

Thanks for the reply.

Textures were all set to wrapped (1/16 samples), I’m starting to think it might have something to do with the alpha output of the slope mask since I’m able to lerp between the two height maps with a constant 1, clamping the result of the slope mask doesn’t help either (I assumed the clamp will put the output between a 0-1 range, but as I said my knowledge of shaders is shockingly bad so I might be using clamps wrong)

You said in my Answerhub post “plugging something like layer mask into height slot of LayerBlend is more of a workaround”, what do you mean by ‘layer mask’? At this point any workaround will do.

As of 4.11(?) we are now able to use Material attributes within the LS Layer Node, should this not also apply to the Height Blend as well? If so was it an oversight by the Epic Angles?

I feel like I am so close to getting this to work but the Height Input of the Layer node is just being a pain https://i.gyazo.com/563f347b8c7bd68e960d5cdaf144b707.png <- I switched to a 3 layer blend because that’s what I hope to convert my curret ls mat to

Hey guys,
I think you are doubling up some functionality currently which is confusing you.

if you use the “layer blend” node with the height inputs, that is meant to be a complete replacement for doing things like heightlerp manually. So if you are going to do that, you should just be plugging in heightmap values there.

If you want to do it manually, then you shouldn’t use the “layer blend” node at all, instead you just place “Layer Sample” nodes and use those as the input to “transition Phase” on the heightlerp node. I feel doing it this way gives you way more control and as a result I never used ‘layer blend’ for any reason.

The kite demo has some examples of the kind of blending I am talking about.

Also there were times when I saw odd results and for some reason doing Lerp(0,1,LayerSample) and then using that instead of the raw layersample seemed to fix it even though that should do absolutely nothing.

Just to clarify, the reason I wanted to be able to plugin the results of a ‘lerped’ heightmap is because my material is procedural(a similar concept to this). I want any layers I paint to recognise the 3 or so heightmaps im blending between inside of these procedural paints.

This is what it looks like when I have a single heightmap plugged into a procedural layer https://i.gyazo.com/367182cc3da9212de4e4a3254b76f96d.jpg, which is the only way of doing it(?), I need it to work on all 3 which is why I wanted to be able to use a lerped heightmap instead, you guy’s were using normal maps for the transition between the two materials whereas I’m using a heightmaps, so how would you go about blending procedural paints together correctly when painted upon by another layer?

Main reason I want to use the layer blend node is because of upkeep (before/after), the latter should be more exspensive because I’m now height lerping on all of the layers instead of selectively and I’m still getting 90 less instructions and was able to remove some code that became redundant within the main material

Also, I don’t know if there is something going on that I’m not aware of but for some reason the colors desaturate when I use layer samples as a lerping value like the kite demo

Sorry if I can’t put together a more clear post, it’s getting close to bedtime haha

Cheers,

Edit: If I’m wanting to texture a single landscape that contains multiple biomes, would this be the correct way to go?

I’m feeling quite confused after reading this. Could you describe the material you are after in details ?

Actually that’s only for one of the rock layers used in the high altitudes. Every other layer used some kind of blend modulation which was using a method similar to height lerp. here are some examples from old testmaps:

In some cases it was just simple height for rocks to poke through:
8d547e6a248a8dcc00f3718b22b80452dca8e411.jpeg

And for other layers, a more macro pattern was used to control spawning patterns which also controlled spawning of different kinds of meshes using the procedural system. In that way, when the foliage was culled out, the underlying terrain would look close enough so you could barely tell. In this image, all of the grass and heather stops rendering about halfway past the image. You could consider this procedural similar to what you are talking about.

I noticed that in your image using the layer blend, you only used 1 heightmap (that is visible in the image) whereas you used scalars for the other layers. You should be able to use different heightmaps for all of the layers to do what you want.

The only reason to use the Layer Samples vs Layer blend is just because you have more control over the layer that way, but doing so also requires using “No blend” layers instead of the default method of blended layers. In the kite demo example, the material could also make layers render where there was no painted alpha, entirely based on large tiling macro textures and share that for foliage placement. You can’t really do things like that with the layer blend method but of course you should do whatever fits your particular workflow best.

This comparison from siggraph slides shows the effect of the modulation. Without it, the blends would have looked blocky due to the resolution being only 1 meter per pixel.

Notice that the pink heather isn’t always matching up with the splat maps, because its largely controlled by tiling macro textures. The weight for it only very generally describes the shape.

I went back and re-read your post and looked at your graphs again I think I misunderstood your usage of the 2 layer height lerp initially. You were just basically finding a way to have a procedural layer exist entirely outside of the layer blend node by having 1 layer come in as 2 layers already pre blended, with the heights blended. That makes perfect sense now.

What is the actual error in the material editor? It could just be some incorrect pin usage or compiler interpretation issue with material functions that is causing this. I have seen a few of these issues lately.

Yuph that’s it, sorry about my explanation, terminology is not the greatest

Heres a basic representation of one of the 3 blended layers:


Pastebin: Landscape Material Example - Pastebin.com
*I left the lerps in for testing

Everything works as long as I don’t plug in the blended heightmap into the layer blend, when I do, I get the default grid material and no error within the material or instanced class, painting and rebuilding the texture pool doesn’t resolve this.

Previewing the nodes shows that the heightmaps are blending correctly.


Post 4.11 we are able to input lerped materials into layer blends, maybe someone forgot to do the same with the height input? Maybe a limitation?

And with the kite demo heather mask I did also notice the grass mask not quite lining up with the texture so I just stole the macro variation code from a starter content example to blend between two material functions, I don’t know if this was the best approach, and I’m not to sure how you guy’s did it since striped your material down to its essentials early on to study, so is there anything you would like to add here?

I think it should be noted that I’m not looking for any complicated control over the minor details since I’m aiming for a stylized and clean cut look to everything, so the SlopeMask and HeightLerp nodes are fine for now, and I’d like to keep it to within functions included with the engine incase I decide to give it to others to use… but if I was to want more control it could be added easily to this setup?

If theres no clear fix for my issue that fine, I’ll continue with this method since it makes my day easier :slight_smile:

Cheers,

Double post

Ok, so I’m happy with the way it done inside of the vehicle demo




And for the transition phase


So far it performs better compared to my last, getting 110-120 fps with just one layer painted and 75-90 with 6 layers contributing to a component. The height blending could do with some work, but that’s cool
Also doesn’t get all weird when paints combine with each other when using layer samples with a mat blend, before it was showing the first layer in between them

Guess the only question I have left is why the SlopeMask node doesn’t work?

Cheers,

http://image.prntscr.com/image/1d05d33bdb0b42c7b922134b688a5c53.png

This is stopping your material from compile.

omg… I feel like I wasted a lot of time…

Thank you very much!

Hey Deathrey,

The image you linked seems to not exist anymore. I know it’s been like, 7 years, but would you happen to remember what the image showed? It’d be very useful!