# How can I spread an object only on horizontal parts of surface using geometry nodes

I have some stylized hills created with geometry nodes (by attribute sample texture) now I need to scatter some spheres only on horizontal parts of the hills. How can I do that?

• I would check the normals. Jun 19, 2021 at 19:13

You can use the Density input of the Point Distribute node to test against the local normal. If the normal's Z component is 1, the face is horizontal, facing straight up. If it's lower than 1, there is a slope. The closer it is to 0, the closer it is to vertical. It can also be negative but in the case of regular hills this should not happen.

In the end we have 2 inputs :

• Factor : At which angle the objects will start spawning
• Density

Possible improvements :

1. Change the Factor input to be a maximal angle instead, using some simple trigonometry :

1. Use a gradient falloff instead of 0 or 1 values when the criterion is met. Using the Attribute Map Range we can setup gradients.

• your attribute separate node really made me nervous....😳. Great solution! Jun 20, 2021 at 4:23
• what? WWII ? where? don't understand. No, i meant the cut text in your first pic - result - result y - result - i thought you had a custom node on my first view but the node width was just too small, so it cut x and z, but not y ;) looks weird ;) Jun 20, 2021 at 11:14
• @Chris Oh, right, didn't notice it, it sure looks weird :p Jun 20, 2021 at 12:17
• Really...i the first second i thought: OMG, Gorgious is a genius. He made custom nodes for geometry nodes.... :) Jun 20, 2021 at 12:21

@Gorgious has said it all.. but this is a very slight variation, (made at the same time)

• Adjust Minimum of Map Range, for threshold steepness, (or other fields, for distribution according to steepness)
• Adjust B float of Multiply for density.

• niiiiiiiiiiiiiiiice!!!! Jun 20, 2021 at 4:25
• @Chris Gorgious has covered it much better, though, IMO. His should be the accepted answer. We could knock out the multiplier, too, and use the one in the distribute node. Jun 20, 2021 at 8:08
• Looks like the user doesn't often accept answer Jun 20, 2021 at 8:12