Material Layer Blend not updating on Landscape mesh

Hi guys,

So in attempt to solve my UE4 woahs of creating blend-able materials with color correction options I have turned to using the ‘Material Layer Blend’ option which you have to enable in the project settings for UE 4.25 & 4.24.
This seems to work well for meshes but not for landscapes. So when I create a Material Layer (which used to be Material Function for me) and then make an instance of that I can add both as Layers in the Master Material Instance. When I tweak one it doesn’t affect the other which is the affect I need but the tweaks only seems to be working on meshes and partly working on landscapes.

Any ideas guys?

maybe explain with a littler more detail what your end goal is.

I think you are just going the wrong way about it, but because of the peripheral explanation i can’t really tell…

If the goal is to have a material layer that affects another material layer - on landscape, then there is no need to use layers.
you just need to lay watever texture on top of the original texture.

For example, with a material function of sand that outputs material attributes, you break the material attributes, drag out the diffuse and multiply by a darker color. Make the material and connect the needed pins into it, then feed it into a blend with an arbitrary alpha (or a layer blend node).
you obviously can repeat the same with roughness and specular, and achieve a wet sand feel that is directly derived from the original sand layer.

At that point, changing textures of the sand layer will change textures for the wet sand as well.

Thanks for the reply. So after many years of working in the VFX industry I’ve finally made the move to UE4 but am quickly considering this a mistake as its so hard to figure out.
I’ve been wracking my brains and writing multiple posts on how to do the following:

  • Layered Materials on landscape/mesh with Parameter Adjustments open for each Material in the Layer stack.

I though the above (which is quite easy in something like Maya with Redshift) would be straight forward but I’ve lost almost 2 weeks on this and I cant seem to figure it out in UE4.

I have tried the following:

  • Materials Layered together using Landscape Layer Blend node. (attached image1, 1a, 2 & 3)

  • ISSUE - My main material is built with Material Functions so everytime I make a new material I have to go through and rename all my inputs in the Material Functions to make sure they are unique. For example of my BaseColor, I have to rename BC_saturation to something like BC_saturation_leaves because you cant have more than ne instance called BC_saturation otherwise when you change one it changes all of them with the same name!

    I cannot make multiple Material Instances because I need to have inputs/outputs available and Materials don't allow this option.
    
  • I then enabled ‘Support Material Layers’ in the Project Settings and tested a new Material made up of Material Attribute Layers. This gives the option of creating instances of my Material Layers (which replace Material Functions above) and layer them on top of each other whilst still remaining individual. (attached image 4 & 5)

  • ISSUE - As in my attached image 6, this example works on meshes but only partly works on landscapes. The parameters to adjust things like UV tiling and rotation seem to work on landscapes but not color adjustments as you can see in the purple tiling. The tiling of two leaf maps works in both the cylinder and the landscape but only the color tint seems to work on the cylinder - so confusing how its not consistent.

So as an example, I’m trying to have the option for me and my team to add 10 materials:

**- Leaves

  • Leaves_B
  • Moss
  • Ferns
  • Roots
  • Mud
  • WetMud
  • Pebbles
  • Rock
  • Rock_B**

And on each one be able to adjust UV, BaseColor, Roughness, Normal parameters such as brightness, saturation, contrast etc but also be able to LERP the same amp back over itself through an alpha tp help breakup tiling and to add Macro Variation to each of the 10 Materials. (attached image 7)

This is just standard material shader layering that I though would be possible in UE4?

Any help would be appreciated.

Many Thanks!

So…
A function is a function. The name of the output or input have 0 importance if not for visual/logical purpose.
Your whole quip on renaming those therefore makes little sense.

You can have multiple instances of the same function in a material. They all interact however you choose based on where they are connected.

Moving on.
The more layers to a material the worse the performance for the finished product.

It is highly preferred to break materials up into several biomes and use the built in world composition system to apply different materials to different mapsin order to get the overall look.
limiting the number of layers per component to 3 is also helpful (even if it doesn’t necessarily look good).

I would suggest refactoring everything you have (starting from scratch i suppose).
start with a base function that can render Any layer.
Feed Texture Objects into the function, and output a material parameters.
convert the texture objects to parameters, and you can change them in a material instance on the fly.

I would suggest feeding some override parameters into the function, like a color for instance, and setting it up so that if that value is not 0,0,0,0 you actually output the multiplied version of the layer (you may want to denature, then multiply. Mostly depends on what you are looking to do.)

Any parameter within the function will be avaliable to All materials and to any generated material instance.

The next thing you’ll want to feed the function is your UV coordinates.
You will feed the texture to a texture parameter, so you need UVs for it.

In the main material you’ll want to use landscape layer chords node (usually set to 7).
You may also wish to set a different Scale offset to allow for the on the fly change of a specific layer. Feed a scalar for it (default of 1) into the function, and multiply the layer chords by it. 1x1 being 1 it won’t change unless you set it.

With all that, you should have the general basis for your layers.

Next would be the preferred way to blend.
the landscape layer blend supports a few. The default and expensive one is the height blend. It takes in a heightmap and computed the blending based on it.

For each layer (except the first one which you almost always want to force as alpha blend) you will feed the heightmap texture into the height pins.

Or, you can just create layer samples, and manually construct the blending by blendmaterialatteibutes node using the layer as the alpha pin.
this is more performance friendly, but you end up having to do some base math with the layers at time to subtract one from another. It also requires that you blend the same layer onto itself initially for proper rendering.

this should get you a good basis of a material that you can manipulate via instances.
normally I create 2 or 3 instances and different biomes this way…

Things i didn’t cover that you should know/apply is the macrotexturing, needed to avoid tiling. And the distance blending. Both these things can be applied within the layer function.
Also possibly tessellation. Even if i usually disable it, you can set a distance tessellation within the function as well. And a multiplier to scale the G on the final output of world displacement is also helpful…

Thanks for the response although I’m not sure you fully understand what I was trying to create.

The new Material Layer Blends tools seems to work but only partly work on landscapes.
Is there anyway to get this to work fully on landscapes or is there a quick way to rename parameter names within the Material Editor inside UE4?

Because no matter what you do, if you duplicate Material Functions or create instances out of them Im always finding same naming conflicts.

Thanks

re-read what I wrote.
You should have 0 naming conflicts.
The area you circled in yellow is a set of functions.
Each function has an IN pin and an Out pin.
If you want to use the same function over and over you can feed a different value to the IN pin and the output will be different.

All the parameters WITHIN a function are globalized.
You would need to add Input pins for each of them in order to get them instanced with a custom variable.
Hence, if that’s the issue start from scratch by making a global function.

Thanks for the reply MostHost LA

And that is the issue right there!..I totally get that each Function has an IN & OUT pins but the whole point of making a function is so that you dont have to keep remaking the same parameters again and again. But if I want to reuse my functions in the same setup I have to dive into those functions and rename them all so they become unique - hence why I was asking for a simple renaming tool to make this task easier. Also I’m not sure what you mean by ‘Global Functions’?..do you mean Global Parameter Collection?

Also another route that I went down was Material Layer Blends (which I have described above). The ‘Material Layers’ there are basically ‘Material Functions’ but you can instance them and they ***actually ***work and remain ***unique ***in the Material Attribute Layers node - however (as I stated above) it only seems to ***partly ***work on landscapes, I would expect it to either work or not work - but partly working is very odd. The exposed parameters that affect things like UV’s work fine but anything with color adjustments doesn’t come through on landscapes, but seems to work fine on a cylinder.

Does anyone know if this is a bug or am I missing something on the landscape. On a simple cylinder it seems to work fine, or is there a simple way to rename quickly - and/or add suffixes/prefixes to parameter names in the material editor.

Thanks again.

You are missing the core concept.
if you want to parameterize a function with different parameters each parameter HAS to be an input.

Ever coded anything before?

You have
Function x(a,b,c) {
Y=1
Return a+b+c+Y
}

And you are complaining that you can’t change Y without creating a new function.

Never coded anything, also not complaining either just merely stating facts and issues that we’re facing and it seems after a lot of searching there aren’t any solution for it, just a lot of work arounds.
So rather than just dump a lot of code in a reply how about a more useful breakdown, or upload an image to show what you are trying to do if its that easy.

We are quite new to UE4 but have a lot of VFX experience, and for our current projects we are venturing into UE!

Many Thanks

Ok, so it seems that the Material Layer Blend option seems to now work on landscapes after deleting all old materials and making fresh ones.
I will continue down this path and update if there are any further issues.

I will also post an update on my process once complete so that it can act as a tutorial for others who might be experiencing this issue.

Thanks

All the information you need was given to you here
You just need to read, try it, and understand it.

You aren’t “stating facts” when you say stuff like “I totally get that each Function has an IN & OUT pins but the whole point of making a function is so that you dont have to keep remaking the same parameters again and again”
You are assuming the inner workings of a system based on what YOU think it should work like… That’s not really going to help you move forward with your project.

Not to mention what you wrote is completely illogical.
First you state that you understand that a function is used to avoid re-making parameters over and over, but all the while you have been complaining about the fact that the parameters aren’t different when you use the same function…

Anyway, let’s move on from that. Come back with actual questions.
A global material function as described in post 4 will look something like this:

Thanks for the reply, I have already created what you have here, and also a more complicated version with more parameter functionality, so here’s my question:

When you use the above setup for a multiple material layered system (eg. landscape layered blend) how do you avoid the parameter duplicates?

At the moment, I have 10 materials and I need the above setup (or something similar) 10 times. When I duplicate it the parameters all have the same name - so when you tweak one, it tweaks all of them because they have the same name!
The only way I can get around this is by going into each function and adding a suffix - which is massively time consuming, hence why I was asking if there was a simple renaming tool.

You don’t, if they are assigned to a pin, you connect a different scalar or texture parameter value which then takes over overwriting the default.

So in other words, make all the parameters you want to change within a function into Inputs and create a custom value to drive them within the main material.

the values you don’t do this for will all be the same, essentially global.

I dont mind writing it again. But you are shooting your self in the foot with 10 layers. You’ll be GPU bound at a very low performance treshold when using a lot of them in the same tile.

So the way I see it, you have to brute it force it either way.
I can either go through and rename all of my functions for every one of the 10 materials, or I do it your way and I will have so many exposed parameters that I will then have to brute force and plug in manual inputs for every function I’ve exposed across 10 materials.

Ok thanks for your help MostHost LA gonna try another way through Material Layer Attributes - it seems it might work, once I created a brand new material and re-imported the terrain.

Thanks