Landscaping headache, masking, blending etc

There are alot of things regarding making landscapes for games that I find not so satisfying.
At first I attempted to mask out cliffs, grass and sand using bw textures. But the transition from black to white on a 2048x2048 texture is so long in the world that I end up with ~500 meters of green-tinted sand.
So I tweaked the edges of the masks with nodes, wich resulted in ~0.2 sqm big pixels of either grass or sand. And I really do not want to use 8k textures to mask the land.

Then I went the slope/height based materials approach, wich gives extremely bad precision. It does not care that I want rough grass at that xyz coordinate.

Today when I woke up I got an idea that I will attempt today wich is using spheremasks multiplied by a bw grass texture, to get jagged edges and position these masks in the world. However it sounds like a longshot to me.
Perhaps the fact I never created a landscape for a game before is the issue here :smiley: Since ontop of the ground texture there will be foliage and rocks etc and I do not know how much of the ground that have to be visible and how precise it has to be.

So if anyone know of some tricks, places to get inspiration or such it would be greatly appreciated :slight_smile:

Okay so the spheremasks turned out really nice in my opinion, that is two spheremasks covering alot of the terrain. Now back to making the materials look decent, meanwhile I need a similiar approach for the edges of the terrain type blending. So that its not as uniform, but I guess that could be done by spending more time on the terrain height map.


I’m still working my way through this myself, so I can only describe an approach that seems to be promising to me, anyway. I don’t know how well it will hold up.

To begin with I watched this video and subsequent installments.

Not tutorials, really, but more OTS views of the author’s dev process as he creates distance blended mats and then combines them.

So leveraging what I learned there the basic approach I’m trying is:

  1. I have a generic function that distance blends a diffuse/normal and outputs the result and the heightmap, as in the videos.

  2. I have those plugged into a material parent that slope blends rocks and grass, and does a sand/dirt to grass transition at a definable z.

  3. I have the output of that material plugged into a landscape layer blender as the first, alpha blended layer.

  4. I then secondarily connected the grass, rock, and dirt functions to the layer blender as weight blended layers 2 - 4.

What this lets me do is paint the entire landscape with layer 1, which uses the slope and z to make basic decisions about what should be exposed rock, what should be grass, and what should be dirt. I can then use the other layers to paint in distance blended adjustments where I want them, and also to paint in other layers I expect to add (leaves, mossy ground, etc).

I’m in the process of replacing the placeholder textures I used with purchased assets, and if I get it looking good I will post a pic of the result. I also want to try some other things like some anti-tiling techniques in the grass and sand.

1 Like

That video specifically was a really good knowledge :slight_smile: I saw it I while back when I attempted the first landscape material. The idea that you can lerp textures like that based on distance is a nice touch.
I’ve done alot of work today on the landscape, my goal was to have a material that is pretty much automated that it does not require alot of (no) painting for reuse on other terrains.

EDIT: I forgot I changed back to slope/height blending without using the landscape layers and height! I might be wrong but the blending that is done inside the engine, should, and seem like it becomes alot smoother.

I’ve also created a sand that sparkles in the sun, it’s not perfect yet so it needs more time.
I used a distance blend and a ton of other goodies for the reflections, distance blended a detailed normal map and a normal map for the landscape when further away.
I think the approach you mentioned seem pretty solid, the only issue im still having is getting rid of the line that appears when z blending.

So far I love the idea of materials with a bunch of parameters, it feels like the extra time making the material is worth it if you plan on having alot of different terrains.

I put each terrain type in its own function, and then created a blending function wich does all the blending between types. Then hooked the blending function up to the landscape material, not sure if that extra function call affect performance alot but it looks cleaner :slight_smile:

For anti-tiling I found the best way to be again, distance blend, mixed with my spheremasks I posted in the beginning. You can blend the ground texture and normals into for example a flat normal map and a texture wich is just a color with some variation.
Because in the real world when things are really really far away you wont see alot of detail only colors.
You can make a texture rgba, and put a tileable mask in each channel, I am using only one mask so far. Tile them all over the landscape, and position sphere masks anywhere on the terrain, then choose variations of grass, sand, dirt, rock that will appear where the mask causing the terrain to go white.

With that said I have no idea how sphere masks affect performance, I did some optimization today (first time). I went from 22fps to ~130, I’ve already forgot what was causing the drop tho.

Would very much like to see how your project turns out!
I will too most likely post more pictures in this thread since there are a million things I have to make now, and most of wich will cause problems!

I’d love to see some photos of your sand. I’ve been trying to create my own really convincing looking sand as well.

Sure ill post it here.
I ended up using my function blending and inside the landscape material I added layers like you had done, and hooked em up to other versions of the terrain types.
Like mud, different grass types, sand types etc.
The grass function I used distance blending to get rid of the tiling.

Closeup:
Detail normal map
Texture map

Far away:
Blend between detailed normal map and world normal map
Averaged color

The color and texture is overlayed with a noise
Rgb values from the texture are taken out seperatly and multiplied by a paramter each, followed by a power of a parameter to control the contrast between dark and light areas. And multiplied by the noise.
The 3 color paramters are then added and divided by 3, same with the 3 power parameters. Then the averaged color from the texture is multiplied by the average color multiplier and average dark/light factor.

This means that on any one spot on the landscape, the grass color shifts a bit. And it shifts the same way when far away.
Now I think its a matter of making a decent texture ,tweak some numbers, and adding all the variations but the idea seems to work.