Using Material Functions with Landscapes

This is another reason I need some screen shots. When I don’t use the MaterialAttributes as the final pin, it doesn’t allow me to connect the MaterialBlend node to it.

you need to use a “break material attributes” node and then wire up each individual pin to the final material node.

customUVs should just go on that node as well.

I guess I am still failing to see where I can connect my landscape coordinates to adjust the coordinates of each individual material that I want blended. If I connect custom Uvs to the last node it will adjust everything at once.

In essence I want to “Lerp” actual materials together with different coordinates like I can with textures.

I would do it by instead hooking up your landsacpe coords to the UVs of your texture sample inside of your material function rather than passing everything downstream. The only reason to attempt to calculate basic UVs on the customUV shader is on mobile.

If you want to use customUVs like that, you need to

a) use a different CUV channel for each different tiling, as you cannot blend between different tiling factors on the same UV channel without warping textures.
b) hook up all the customUV pins inside of a matlayerblend function. Either just overwrite _standard to do it or make a new one.

(side not but I never bother to use landscape coords for anything. I always just use worldposition-XY so tiling on regular static meshes can match up).

Does the Worldposition-XY match up with the basic texturecoord node?

Not sure what you mean by “match up”? It just means taking the WorldPosition node, component masking by R and G and then dividing by scale. 4.8 has a material function that makes this a bit quicker.

It matches in that it results in a v2, but it won’t match the size or anything. UVs are local to the mesh surface whereas worldposition returns the location in the world. Its a way of getting consistent tiling anywhere in the world.

The only time landscapecoords are useful (imo) is when mapping a whole-landscape color map texture of some kind.

Ok well now im lost. I really need a visual on how to do this.
I need to see how I am able to scale different material function then “lerp” them together so they can be used as paint-able layers on the landscape. Because I did buy a few materials that I wanted to use. But they usually come with tons of textures with tons of different TextureCood nodes attached to them. So instead of going back and figuring out how to convert them to the scale of the LandscapeCoord node (since they dont match), I was hoping to just scale the whole material to fit whatever I want.

4c59ed4a7fb4a855086f1f9549bd0949bcd70891.jpeg

all you need to do is connect your UVs directly rather than try to use custom UVs.

Finally Success. I think I was getting confused about all the extra things you were trying to tell me lol

Also (looking at picture 2), I know earlier you said that I needed to use a sample node in order to create Landscape Layers. Where can I attach it using what I have here?

Now, this material worked well because I just swapped them out like you said and that the TexCoord were all set to 1,1. But for another Material that I purchased (Picture 3), the highlighted TexCoord that I would replace already has a value of 5,5. So if I hook up the input there, what value should I be putting into the Landscape value in my Material? Is there a node of equation that converts them?

>>Also (looking at picture 2), I know earlier you said that I needed to use a sample node in order to create Landscape Layers. Where can I attach it using what I have here?

Attach it to the “Alpha” of your MatLayerBlend node.

>>the highlighted TexCoord that I would replace already has a value of 5,5. So if I hook up the input there, what value should I be putting into the Landscape value in my Material? Is there a node of equation that converts them?

The scale is all relative but landscape coords are inverse. So technically a value of 1/5 would be correct but I doubt it would be what you want. First develop a base scale and then match things up relative to that.

You could just add another multiply and add in the scale difference there. ie if your TexCoord nodes had scales of 5,5 and 10,10, pick some landscape coords “mapping scale” value that looks good for the first texture, then multiply that by 2 before going to the 2nd texture (actually that would hook up to the “multiply by macro medium” node. in that example.

You could also apply the inverse scale within the LandscapeCoords node. with landsacpe coord node, higher mapping scale equals bigger texture which is the opposite for UVs. So if you want a texture to be more tiled, divide mapping scale by 2.

“Attach it to the “Alpha” of your MatLayerBlend node.”

That would not work for me since I need an alpha in there to blend the nodes together. So I had to break everything and put them in to their own landscapeLayer nodes.

So in other words there isnt some nice node that could take care of that calculation between a TextureCoord and Landscape Coord. Thats depressing, thats a lot of experimenting I was hoping to not take the time on with every different material and landscape.

But here is the look of this material, for those who want to see. Let me know if anyone needs more info.

I have no idea what you are doing above but it does not make any sense. There is no reason to break the materials attributes like that and to use LayerBlend nodes on individual components.

What I suggested is what you need to do. Don’t use any LayerBlend nodes anywhere in your material. Create a “Layer Sample” node. hook that up to the alpha of your “MatLayerBlend_Standard” node. Then hook the matlayerblendstandard node to your material attributes final pin.

LayerSample IS an alpha that is paintable. It returns the weightmap alpha of a paintable layer.

c5be6fa80b425b7e2a78c94f48673fdd578bdf04.jpeg
Just disconnect the texture alpha, hook up Layer Sample as alpha. Done.

if you want to combine some of the noise from your hooked up cloudy texture, you need to look into the “heightlerp” node.

I can’t use the HeightLerp node because its not compatible with the material function node because they are not a Vector3.

In essence I want the control to be able to do something like this.

Just imagine that all the (Non-Alpha) Texture samples are Material Functions. I want to be able to lerp a few whole materials together with different scales to make a nice blend to use as a single paint-able landscape layer. Then do the same with the other landscape layers. Same as I can clearly do with regular textures.

Exact same answer as before. I am not sure where the hangup is.

You are mis-using the LayerBlend node. As I said many times, do not use it anywhere in this material. It does not work with functions.

All you have to do is hook it up like my image where I hooked up a LayerSample to your alpha.

And you can use HeightLerp. You simply use the “Alpha” output pin without ever using A or B inputs. Please load up the content examples map “Math_hall.umap” and see an example of exactly that.

>>Just imagine that all the (Non-Alpha) Texture samples are Material Functions.

That is exactly what I am trying to help you set up. That is the entire reason why material functions and “matlayerblend_standard” functions exist. We made them for exactly this purpose. I’d like to help you but I cannot help you if you do not try what I suggest.

Respectfully, I did try but it said it didnt work, thus my last response. If I am supposed to use the alpha pin for something, you need to tell me. You are talking to a novice asking for help, don’t just assume I know how to use a specific node. But remember, I said I am a visual learner, its how some peoples brain works, thus why I kept asking for a screen shot of the whole process, since I don’t see any other documentation anywhere. So now I will go find the Math_Hall map.

Take your “Layer Sample” node and hook it up to your alpha pin. I was always clear what to connect there. You said you tried it but it did not work. You did not say that previously. What didn’t work?

8af86940c84120c8da5693632f7ec24dff5187ca.jpeg

Simple setup. Two layers as functions with UV input. “LAYER SAMPLE” is only alpha. The name of the layer needs to match the name of a layer in the landscape tool, just as your “Layer Blend” nodes would have to match.

On the terrain I painted a U. Notice the different layers are at different scales:

Now here I will add heightlerp using a checker pattern. The “checker” could be a texture or anything, doesn’t matter:
b0d3368779c6cb8def37accc7a2abf77c2c57b18.jpeg

The affect on terrain is to modulate the paintable layer with the supplied height input:
5b8ef326c42ac7a4e425543d3e9cc4d08a736cbd.jpeg

Here is multiplying by checker instead of heightlerp. Thats like an additional mask:
7b58d70b98fd203f12cb7108ecf2c79692e35058.jpeg

Here is the result on the landscape:
b62cca4ce4586442141a44e9c872aaa4d05afa62.jpeg

Any here is what the functions look like. Should be the same as yours.