• News

• Industries

• Learning & Support

• Community

• Marketplace

# Can we "clamp" landscape layer height blending?

As you can see on the screenshot, I’m trying to blend rocks on grass using layer height blend.

I tryied using “height blend” type on both grass and rock layers, “height blend” for rocks and “weight blend” or “alpha blend” for grass. I also have some maths to increase and offset the heightmap contrast but as you can see, some rocks still looks to be under the grass, even while painting rock layer with a tool strengh of 1 and a falloff of 0.

It looks like where both layers blends, height values of both layers blends too, so even if the height value of the rock is 1 (white on the heightmap) and the height value of the grass is 0, the height value result of the blending is 0.5, which means showing 50% of each material

Is there something I can do to “clamp” the height blend so the rocks will always appear without grass blended where the layer weight is 1 and the heightmap is 1 (white)?

From what I understand, the weight of a layer still “weight blend” layers set to “heigth blend” until the weight of the layer is 1. In my case, a layer weight of 0.5 means 50% of grass + 50% of rocks height blended with grass. So I don’t think that what I’m lookinf for is possible.

your rock layer should always over power the grass. Since usually the grass isn’t present when you have a rock.

I’m not saying that it is 100% impossible to have a grassy rock, per-se, but it is highly unlikely. Grass on a rock is often Moss.

If you set your grass material to alpha blend, and your rock material to height blend ypu should get this result.

If you aren’t using layers, then the answer is to subtract the mask (with a multiplier to make it brighter perhaps) from the grass, Clamp the result, and apply it as the base color.
repeat for normals etc.

BiasScale height from 0 to 1 into -1 to 1 range, before plugging it to HeightBlend.

I’m using my own height blend function to have more control than what the LandscapeMaterial height blend allows for. Note that for this to work, you’ll have to set all your landscape layers to non-weight blend and then paint bottom-to-top… which depending on your case might not be desirable.

In the material, I use a flat color to cheaply establish the layers. Then I daisy-chain my materials and blend them using the sample node, always outputting the resulting new height for the next blend. At the end, I just overwrite all the attributes with the output of the final blend. This is probably not the most performant, but works in my case while giving me full control over how sharp the blend is to be on a per-layer basis.

Can you show how the landscape blend looks please?

In the landscape blend node, I set all layers to ‘alpha blend’. Then when painting the landscape, all layer info’s need to be set to ‘no weight-blend’.

As I mentioned, with this technique you’ll have to paint bottom-to-top, which is not always ideal. But I’m fairly happy with the control and results it gives me, vs the built-in height blend.

You mean multiply by 2 then substract 1 (or using ConstantBiasScale node)? That’s the maths I’m actualy using to increase the heightmap contrast but I’m not sure it has something to do with the heightmap.
As I said, it looks like layer weight is used to weight blend layers no matter the blend type instead of increasing the heightmap strength of the actual painted layer

By default the layer weight is used to merge the 2 height blends. But.
What is 11 or 01?
If your map is gray or .5, then .5*.5 is not the same as the 0-1 range.
Basically your rocks needs to be full white if they are to be drawn above the grass.
or you could just make sure that the grass has no values above .5 in its heightmap to get similarly decent results?

Thats where the constant bias scale comes in too.

No matter how contrasty you blendmap is, it will give you window of soft blend.

By playing with scale and bias, you can get the blend to be more sharp, at expense of blend region size.

That all applies to landscape layer blend material expression.

To get even sharper blend, you need to use something like heightlerp with two heightmaps material function, combined with landscape layer sample material expression in lieu of landscapelayerblend.