# PCG spline from landscape material border 

**URL:** <https://forums.unrealengine.com/t/pcg-spline-from-landscape-material-border/2721494>\
**Category:** World Creation\
**Tags:** unreal-engine, question\
**Created:** [May 11, 2026, 11:26pm UTC](https://forums.unrealengine.com/t/pcg-spline-from-landscape-material-border/2721494 "2026-05-11T23:26:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nixx73](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nixx73](https://forums.unrealengine.com/u/Nixx73)\
**Post date:** [May 11, 2026, 11:26pm UTC](https://forums.unrealengine.com/t/pcg-spline-from-landscape-material-border/2721494/1 "2026-05-11T23:26:02Z")

</div>

Hello guys. Any idea how to make a spline follow the border between 2 landscape materials ? Tried a few things but no luck so far. Would be cool to help make automatic fences or walls .

 ![Capture d'écran 2026-05-11 231952](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/f/b/dfb6b8904a2322e9a48502036c1a2b2754375130.jpeg)

---

<div class="post-metadata">

**Author:** ![AreWeGaming](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/arewegaming/32/1174860_2.png) [@AreWeGaming](https://forums.unrealengine.com/u/AreWeGaming)\
**Post date:** [May 12, 2026, 12:12am UTC](https://forums.unrealengine.com/t/pcg-spline-from-landscape-material-border/2721494/2 "2026-05-12T00:12:56Z")

</div>

> [@Nixx73](#):
>
> Hello guys. Any idea how to make a spline follow the border between 2 landscape materials ? Tried a few things but no luck so far. Would be cool to help make automatic fences or walls .

Automatically generating a spline that perfectly follows the sharp border between two Landscape Materials isn’t directly supported out of the box, but there are several good approaches depending on how precise and automatic you want it to be.1. Best & Recommended Approach: Landscape Splines + Manual/A semi-auto Placement

- Use Landscape Splines (in Landscape mode → Splines). They are specifically designed for this kind of thing (roads, fences, walls) and will conform to the landscape surface.

- You can attach fence/wall meshes directly to the spline segments.

- For borders: Place the spline roughly along the transition area. You can then use the spline to also paint a Landscape Layer (e.g., a transition or path layer) to clean up the material blend if needed.

This is the most common and performant way for fences/walls.2. More Automated Solutions

- PCG (Procedural Content Generation):  
Sample the landscape layers or Physical Materials along a grid or existing spline, then filter points where the weight of one material vs. the other is around 0.5 (the transition zone). From those points you can generate a new spline or directly spawn fence meshes.  
This is probably the closest to true “automatic border following.”

- Blueprint/Python Script:  
Write a small editor utility that:

- Manual Painting + Spline: Paint a thin “fence layer” or “border” layer where the two materials meet, then use that painted area as a guide for spline placement or PCG spawning.

Quick Tips

- Assign different Physical Materials to your landscape layers. This makes it much easier to detect transitions at runtime or in PCG.

- For fences/walls, Landscape Splines have built-in support for meshes with random variation, up-vector alignment, etc.

---

<div class="post-metadata">

**Author:** ![Nixx73](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nixx73](https://forums.unrealengine.com/u/Nixx73)\
**Post date:** [May 12, 2026, 7:33pm UTC](https://forums.unrealengine.com/t/pcg-spline-from-landscape-material-border/2721494/3 "2026-05-12T19:33:15Z")

</div>

> [@AreWeGaming](#):
>
> PCG (Procedural Content Generation):  
> Sample the landscape layers or Physical Materials along a grid or existing spline, then filter points where the weight of one material vs. the other is around 0.5 (the transition zone). From those points you can generate a new spline or directly spawn fence meshes.  
> This is probably the closest to true “automatic border following.”

Thank you for your detailed answer.

Solution 2, PCG, Is what I tried before but as the points aren’t ordered, the create spline node makes a mess. How would I fix that ?

---

<div class="post-metadata">

**Author:** ![AreWeGaming](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/arewegaming/32/1174860_2.png) [@AreWeGaming](https://forums.unrealengine.com/u/AreWeGaming)\
**Post date:** [May 12, 2026, 10:20pm UTC](https://forums.unrealengine.com/t/pcg-spline-from-landscape-material-border/2721494/4 "2026-05-12T22:20:43Z")

</div>

Yes, that’s the classic problem with PCG + borders — the points are generated in random order, so Create Spline connects them in the wrong sequence and creates a huge mess.Best Ways to Fix Point Ordering in PCG:1. Best & Cleanest Method (Recommended)Use PCG + Trace + Sorting to create an ordered chain:

- After sampling the transition points (where the two landscape layers meet), use a PCG Point Filter or Density Filter to get clean border points.

- Add a PCG Create Spline node, but feed the points through a Custom PCG Graph or Blueprint that does proper ordering:

This “nearest neighbor chaining” is the most common solution for border splines.2. Simpler Alternative (Good Enough for Many Cases)

- Use Landscape Splines instead of regular Spline Actors.

- Or generate the points with PCG, then use the “Project Points to Spline” or convert them into a Spline Mesh chain with a PCG Spawn Actor node that places small spline segments.

3. Even Better Approach (Hybrid)Many people combine both:

1. Use PCG to detect and spawn points only on the material border.

2. Use a small Editor Utility Blueprint or Python script to turn those points into a clean ordered spline (much easier to sort in Blueprint/Python).

---

<div class="post-metadata">

**Author:** ![Nixx73](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nixx73](https://forums.unrealengine.com/u/Nixx73)\
**Post date:** [May 14, 2026, 1:57pm UTC](https://forums.unrealengine.com/t/pcg-spline-from-landscape-material-border/2721494/5 "2026-05-14T13:57:37Z")

</div>

Is there a tutorial for this method ? :

"Add a PCG Create Spline node, but feed the points through a Custom PCG Graph or Blueprint that does proper ordering:

- Use the “Sort Points Along Spline / Direction” technique.

- One reliable way is to:
