How to Filter Out Steep Slopes in PCG to Prevent Tree Spawning?

Hi everyone,

I’m working on a PCG graph to generate trees on my landscape, but I’m running into an issue where trees are spawning on steep slopes, such as mountainsides, where they shouldn’t logically appear.

I’ve debugged the PCG points and confirmed that the Steepness attribute is present but doesn’t seem to change based on the actual terrain slopes.

My goal is to filter out points on steep slopes entirely so that trees only spawn on flatter terrain. Does anyone have experience with this or know how to properly calculate or filter steepness in PCG? Any advice, tips, or examples on how to remove points based on steepness would be greatly appreciated.

Thanks in advance!

After playing around with the nodes, I found a normal to density node and used the visualize attribute node to see what that data looked like on the landscape. I was able to use that density data to filter out the trees using the attribute filter.

These are the results so far. Not sure this is best practice yet, but it’s working for now.

2 Likes

Hey Kenny, I had the same problem and I found that you can use the rotation attribute to achieve that effect, basically the idea is that you want to keep only elements that are in a given range of rotation.
We don’t care about the yaw for our purpose :

So a very basic setup is just to use 4 attribute filters with the maximum and minimum pitch and yaw

For instance if we want anything on a slope above 30 degrees to stop spawning, you can set up the first roll filter like this

The second like this :

And do the same for the pitch filters.

Hope this helps !