PCG - Paint Landscape Layer

I’m trying to create procedural trails/paths using PCG - I’ve managed to use pathfinding to create a path between points A and B, then the landscape is deformed using the landscape patch. My next step is to (try) apply my dirt layer from the landscape mat to the path.

Currently I am able to see the Layer as an attribute and add to that attribute, however, I’m not sure how to visually update the landscape.

Just wondering if anyone else has managed this? and if so any chance of getting some help?

With the current PCG, we can’t modify the landscape. The Landscape Blueprint Brushes are for that, however they are not properly working either :slight_smile:

Hey, thanks for the reply! Do you mean we can’t modify the landscape material? I am currently modifying the landscape using PCG.

I am not aware of any method of modifying the landscape using PCG. I’ve tried with Landscape Blueprint Brushes, but I am not sure what type of modifications you are doing on it by using PCG.

From what you’ve done it seems that you’ve managed to modify the height and now trying with the weight? If you are using Landscape Patch it might be a landscape patch question rather than a PCG question.

1 Like

Yeah basically, I have 2 graphs - one is using the pathfinding node to generate a spline from point A to B that avoids slopes, the second is spawning landscape circle patches along the spline to deform the landscape down within the spline boundaries.

I update the Landscape layer attribute for layer2 (soil) from its current weight to a value of 1 within the area of the pathfinding spline (the values in the screenshot).

Just need that attrib update to be applied to the landscape and show the soil layer along the path

“it might be a landscape patch question rather than a PCG question”

That’s a very good point! Thank you!

Understood. I am looking for a non-destructive way to modify the terrain splatmap/weightmap
for ages (I have a partly gen terrain in WM) and I can say that I haven’t found anything relevant.

Modifying the attribute in PCG, I’m 90% sure that will have no effect. If you find anything please, let me know, I’ve made a related post here: Problem with Landscape Edit Layers Weight + Blueprint Stamps - Development / World Creation - Epic Developer Community Forums

1 Like

Yeah I will do, I think you’re right as you can use patches to modify the material, just not sure how…

Apply both the terrain paint (because afterall if you are using that s*it you need the physical material response off of it) and decals.

In the more sane case in which you switch to using static meshes, you peobably need to still apply some sort of paint dynamically. You can likely do that via render target and still come out on top.

Re the simple question of how you modify the landacape.
Unless they meesed the engine up (which they did, so…) beyond all hope, a spline will suffice.
Go from the pcg to a spline, then from the spline via a quick bluetility call (look it up if lost) and apply the terrain deformation from the spline.

If your spline has wide enough turns it’ll work and look OK. If your turns and details are below a 1m resolution range it wont look too hot.
In that case, just make meshes instead of having to make meshes anyway later for performance reasons…

I have managed to partly get it working:

However, because you are enforced to use a Landscape Edit Layer the problem mentioned in my post still persists, because for some reason the Edit Layers can’t paint the weight fully.

If you find a workaround, please let me know since it would also solve my problem with the terrain editing. Many thanks!

1 Like

Does it need to remove the current weight aswell?

I have no idea if that would work. Let me see if I can make it to also remove the current weight… but I can’t see how that’s possible with Landscape Edit Layers.

Edit: I did not manage to remove the Grass from below to purely add my Earth on top, so that there’s a clean blend. The mentioned solution with terrain-blend splines seems the best approach at the moment.

Edit 2: It still seems to me there’s a layer bug in the landscape, somewhere in the ‘ULandscapeEditLayerBase’ class or some class that composes those layers to obtain the final weightmap. Trying to look through the code on the layer combination part if I might find any problem there.

Edit 3: The problem seems to be related to the GPU blending of the layer weights, located in the shader: ‘/Engine/Private/Landscape/LandscapeEditLayersWeightmaps.usf’ (FLandscapeEditLayersWeightmapsMergeEditLayerPS class) however, I do believe that I would require a confirmation before opening a ticket.

1 Like

I’ve almost solved it - managed to get the texture

Just need to solve the density and optimise it then I’ll break it down.

1 Like

Looking forward to it, I was out of ideas :slight_smile:

1 Like

UE is hung at moment so can’t break down with screenshots but the steps are along the lines of

  1. Create blueprint with landscape circle patch (BP_Deform)

  2. Create blueprint with height patch (BP_Texture) - in construct script set landscape layer weight

  3. Create PCG graph that creates pathfinding spline

  4. Create PCG graph that samples the pathfinding spline and spawns BP_Deform

  5. Duplicate the PCG graph that samples the pathfinding spline and spawn BP_Texture instead.

I imagine 4+5 can be merged just set it up separate for tests.

Gonna restart the engine and try clean it up and I’ll break it down further with screenshots.

My next steps are;

  • Optimise

  • create multiple end points

  • try blend between the grass and dirt layer with sand or gravel layer.

I still get the half-weight stuff. The ‘Earth’ Layer I’ve set should look much more intense. Am I missing something?

Apologies for delay, engine hung then I broke PCG

Construct script

Add layer name here

That still doesn’t solve my problem:

The (M) is manually painted, and the (BP) is the weight generated by using the Earth Layer. In your case is the weight properly set on the terrain?

If you add one simple in the terrain, does it properly set the weight on your terrain?

■■■■ sorry dude, Yeah man the weight is properly set…

here’s what I did

Untitled document (1).pdf (1.3 MB)

1 Like