Download

MatLayerBlend Problem

HI all. Got a pretty annoying problem which im unable to figure out.
Hadnt noticed the problem previously, due to the layers blended, being a similar colour.

Basically,when I paint one layer, onto a second… a third layer appears within the blend… Sounds stupid I know.

Heres how it looks.
7f168453a8b000ec41ee307a28e6fc7e177d5161.jpeg
The lighter, rock, that appears between the two layers shouldn’t be there at all, in this particular area. I have only painted two layers.

Here is the material blend section of the material used.
4ecb440e78b369839b1735046957771361f59136.png
The “SandPebbles” layer is painted on everywhere, then I’ve painted on “SandDunes” layer in the middle. The third layer that is appearing is the “LayeredCliffs” one.

Anyone have any clue as to why this is happening? Maybe how I can fix it?

Cheers all, kind of at my wits end with this one, I cannot figure it out.

Cheers all!

Looks to me like you are using Weight blended layer settings. When you do that it attempts to normalize all the weights and it will not know to account for the additional contrast you are performing on one of the layer alphas. I would suggest using non weight blended layers for a setup like this.

You’re kidding.

I’m such a dumb ***.

Thank you RyanB, you’re a life saver!

EDIT: Quick question. Is it normal that the order matters when doing it this way?
It seems with No Weight-Blend, I am unable to keep painting over each layer.

EDIT2: Also quickly. How do you use No Weight-Blend with tiled imports? It doesnt give you an option to do so.

Yes, that is expected. That is because with no weight blend, you are defining the layer order in your material by the order you chain your nodes together. I would recommend ordering them based on physical relationship. ie… bedrock then dirt then grass then snow in most cases. Then anytime you want to expose rock, just think about peeling away the top layers to expose it.

You can actually get weight blend with blend modulation but you need to use only the landscape height layer blend node. There is not quite as much control there but it is doable.

You can also do some manual height based weight blending with custom height lerping if you really want to be the math gets a bit tricky. Basically you would use your bottom rock alpha (with contrast adjustments applied) to subtract from the above layers. It gets a bit hairy though to do it correctly for many layers so I don’t really recommend that unless you really understand how weighted blending works.

Ahh ok. That makes sense. Thats also generally how i order my layers too. Except it seems I have been doing them backwards XD

So what about importing tiled landscapes with non weight blending layers?

Thanks again Ryan. Help is very much appreciated.

OK. Well I thought i would give it a try.

I imported a tiled world. No option for the Layer Info type. So, I imported the world, saved, closed the editor. I then went and copied existing non weight-blend layers into the newly created shared assets folder for the tiled landscape. And to my surprise, it worked.

A bit awkward, but it works.

I agree the tiled import dialogue is a bit lacking in features and polish.

It has been a few months since I used it but I seem to recall that if I pointed it at my existing material it just used the existing layer assets without automatically making new ones… did you specify a material and it still made layer assets for you? It is unfortunate that it doesn’t let you choose.

Yeah unfortunately it doesn’t work too well.

It needs an option for the blending type. I thought I had found a work around as mentioned previously. But that only solve half the problem.

Placing pre-existing “No Weight-Blend” Layer Info files into the map folders shared assets does make it paint like a No Weight-Blend layer, as in the rock is always at the bottom and you have to “un paint” the previous layers, which is nice.

Not sure if it still gives that halo issue. Or its a problem with the layer generation from world machine. Will have to experiment more.

Cheers for all your help Ryan!

So. I have been playing a round a bit more trying to get stuff to work. But to no avail really.

When importing tiled terrain. I seem to get a halo of the top most layer (cliffs) around the bottom most layer (dunes).
Even after swapping the layer info’s for “No Weight-Blend” ones.

This is the material.
wW5EfbW.png

And this is how it loks when applied to the terrain.

I have coloured the cliff layer pink. And as you can see its everywhere.

If I create a different material with just colours for each layer. Like so…
3FTD7Te.png
It works fine…
4y1lsq9.png
Here you can see the pink cliffs only showing up on the steep faces. As it should be.

This rules out it being a problem with the weight map generation from World Machine, as I thought it might have been.

So I tried again using the MatLayerBlend style blending, but with just plain colours. Like so…
c06f4f4f3b6081c424821b49ebb1adf2066d8766.jpeg
Each colour function is essentially this. (Yes I know I should have just made a function input or something)
b0c0fcb3ed38842d2cb0d7b46ea42153f1ea95e9.png
As you can see, I am still using the height blend for the dune layer.

And here is the result.
HtRTNuQ.png
Same as the first time round. As you can see the dunes are still blending by height, but the cliff layer is everywhere it shouldn’t be.

So it looks like im having the same problem I originally had… However. What’s more confusing is that all the layers still paint absolutely fine. As seen here…

All the landscape screen shots are taken from the same position. The first and last screenshots are both using the exact same material.

I just can’t figure out why with that material, its showing the cliff layer everywhere, when it clearly isnt there.
I literally have no idea why its doing this and its driving me insane.

I know I can just use a material with the landscape layer blend node. But then I wont be able to use Material Functions.

Can anyone tell what the hell is going on? Cos I really cant.

Thanks in advance everyone.

Is it possible at all to alter the order in which weightmaps are imported?

Like this I mean.
9fb1523cdefed3cc52730339725de8731cd15471.png

This isnt the order in which I have set them up in the landscape material. I need the SandDunes to be at the very top as they are in the material, so it looks lie the dunes are spread across all layers where it applies.
As it is, the SandPebbles layer takes priority and creates a hard edge where it blends over the SandDunes layer.

Any ideas what I mean anyone?

There should be no affect from the order the layers appear in the import dialogue. You are in control of that with your material.

I am not exactly sure what is going on, but to me it seems like you are doing your layers backwards. The way you are modulating your bottom layers is affecting all top layers. I think you should reverse it so the rock is the bottom, then cliffs, then cracked earth, then pebbles, then sand etc.

I was asking about the layer order cos it does matter if you are using https://docs.unrealengine.com/latest/INT/Engine/Landscape/Materials/index.html <---- this type of material.

And I’m pretty sure I am doing it that way around. The Cliff is the bottom most layer, then Rock, Cracked Earth, Pebbles, Sand.

The thing I dont understand is the material works perfectly fine. The problem only seems to occur when importing a landscape.

Here is the entire setup in WM anyway. Just incase you spot something I’ve missed.
usORr2X.png

I honestly don’t know what’s going on.

Cheers again for the help Ryan

Ah nevermind I was reading it wrong. I do see something a bit off then…

Your bottom most layer does not need a layer weight. So in your graph, “cliffs” should go into the base layer of the matlayerblend above with “rocks” as top. You should not use the bottom layer sample called “LayeredCliffs” at all since by definition it is always white by being the bottom layer. I can’t say with certainty if that is causing the problem but I would try removing it.

I did wonder if that would be the case myself. To just not bother creating a weight-map for the bottom most layer as that one will always be 100%.
Well I tried it, and that didn’t work either.

So i figured I would try doing this sort of setup instead.
3FTD7Te.png

But when importing a tiled landscape using this sort of material, the sand dunes don’t appear at all.
I wasn’t sure If I just needed to reverse the Layer Blend items, but that had the same result.

Not that it would really matter, I’ve never managed to get this sort of set-up working with height blending.

I honestly don’t know how to achieve this. It’s just not working as expected.

Cheers for the help again Ryan. It is greatly appreciated.

Think you have it in the wrong order, Cliffs should be at the top (index 0 in the list ) and sand dunes at the bottom (index 4)

I’m too are trying to make a landscape and this is my layers so far.
L_layers.jpg

Rocks are LB Height Blend with a height mask in the Height Rock Layer blend input. The rest are LB Weight Blend for now.

I have tried it like that. It paints fine. But when I import a landscape, the sand dunes layer doesn’t appear.

Do you right click on the target layers and import the “splatmap”? I have my splats map broken up in to grey png’s, then i did scale em to fit the landscape resolution (2033 *2033 in my case ) then i did right click import em into the target layers. But I do need to say this landscape system is a pain to work with…

Ok, this is going to sound like a silly suggestion but I saw something like this before when doing blending.

Try taking each layer weight and hooking it up to a “Lerp” node into the alpha. You can leave A and B disconnected so it will be a lerp from 0 to 1. Then just hook that up to where the blend weights were. That doesn’t seem like it should do anything, but I once had an issue where a tiny amount of the underlying layer was showing when I did not do that step. I will try recreating this setup later. The only other part that I was thinking is a bit strange is how you use the sand as the “bottom” layer in the final blend instead of the top, but it shouldn’t really cause a problem since in theory the result is the same as if you inverted (1-x) your blend alpha… so the way you have it should work and save that 1-x instruction.

I recreated a simplified version of your material. It has 3 layers total but I blend them the same way and using the same height blend method.
7a4ec7aedc896a44c65ce1f29ad733615f8bfa52.jpeg

I am unable to reproduce your blending issue since it seems the colors show up where expected:
58839b95c621955b5b76e9efbc8dc36e061a043f.jpeg

Looking at the primary colors in photoshop I can confirm it is not bleeding any colors between layers (but oops screenshot is in lit mode not visualize basecolor so dont try to check the above image to confirm)

At this point I suggest:

  1. Try to reduce your example down to be simpler like mine with only 3 colors, and use only primary colors as debug. meaning 1,0,0 and 0,1,0 and 0,0,1.
  2. Then try turning off your height contrast by just plugging the sanddunes layer alpha straight in.
  3. I would also suggest double checking in photoshop if your worldmachine exported weights are actually 100% black and 100% white in the places you assume. Often having a non-saturated value can cause funny results. I don’t think this is likely though since your non-height-blended material looked fine.
  4. If all that fails… what if you paint all your layers 100% black with an intense brush and then start one at a time painting a bit of each layer… does the problem show up the whole time or only start appearing once some layers are painted?

My only other thought is that its the actual tiled import process that is messing up your weightmaps by normalizing them all together since it assumes you want weight blended layers. Maybe the way it does it gives a correct result only when using the landscape layer blend node but not once you modify the contrast. If so you should be able to reimport the layer weights after the initial import to bypass (i hope). I remember at once point that after each reimport it would get slightly more accurate as well due to that same issue.

Thanks for the reply Ryan.

Is there any chance you can fix those attachments? They don’t seem to be accessible.

I will give your previous post a try in the morning and post results when I have.

Again, thank you so much for the continued help!