Landscape Grass Output with a grayscale Mask (not with Layer Sample)?

Is it possible to use the Landscape Grass Output with a texture mask?
It only seems to work correctly when i use a Layer Sample node.

I generated a terrain and some masks to spawn foliage in specific location (unrelated to my layers). Is there some way to do that?
When i plug the mask directly into the Grass output via a Texture Sample it doesn’t work.

Any way to get this done?

I tried to recreate Your issue, but no matter what I do it works. Sometimes UE4 doesn’t refresh the landscape foliage, so just try to force it by activating the foliage tool. You don’t have to paint foliage with it, just activate this mode and exit it. Hope it will help :slight_smile:

Hey Frank!
Thanks for your response!

Selecting the foliage tool didn’t work for me unfortunately.

Maybe there’s something else going wrong. I attached 2 images to show how i set up the grass output in my material

Here’s the result when i set it up using sample layer nodes (in this case i mask out only the “base” area).
Grass assets are spawned across the landscape in the predictable manner. All good here.

And here is when i use a simple mask to drive the output.
No foliage is spawned on the landscape. I wonder if this is even possible?
Or do i need to fiddle around with landscape UVs to let the engine know where to spawn grass?

Thanks again!

Ok, Your screenshot says it all ^^ Basically You can’t leave the UVs input empty. Most people just plug in the LandscapeLayerCoords node and set the mapping scale (the size of landscape in Your case) in details panel, but for more control I prefere to use Z projection, where I can set te scale via material instance.

EDIT: When using Z projection on landscape probably You will have to offset the texture to the landscape pivot point. Plug an Add node with a 2Vector set to X and Y location of the landscape pivot between Divide and TextureSample.

EDIT 2: I checked it on a 63x63 quads landscape and apparently You also have to divide the location by 8 for some reason.

Super awesome! Thanks, Frank!
I’ll give that a try!

Using the Landscape Coord node works like a charm! Thanks!

I tried the Z projection as well, but don’t really get it to work.
My landscape components are 64x64 and i used that as Scale value (tried with your values as well)


I guess i misunderstand something here :slight_smile:

You have the overall resolution 1072x1072, so set the LandscapeScale param to 107200 and if You didn’t move the landscape, it’s pivot should be at X = -53500,011719, Y = -53500,011719. Set the offset params to this values, and it will work for sure :slight_smile:

That’s why I like to use Z projection instead of landscape coords - it gives me full control over texture size via material instance, so I need to create just one master material for all landscapes in the game even if its sizes are different. LandscapeCoord node has te size “hardcoded” inside the material, so for me it’s useless.

The simplified version of Z projection (without offset) is great for setting texture tile size for landscape layers. The value You set for Scale param represents in cm (= UE4 units) how long is the side of one texture tile (e.g. Scale = 400 means one texture tile covers 4x4m).