5
$\begingroup$

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?

$\endgroup$
1
  • 1
    $\begingroup$ I would check the normals. $\endgroup$
    – TheLabCat
    Jun 19, 2021 at 19:13

2 Answers 2

14
$\begingroup$

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

enter image description here

enter image description here

Possible improvements :

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

enter image description here

  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.

enter image description here enter image description here

$\endgroup$
4
  • $\begingroup$ your attribute separate node really made me nervous....😳. Great solution! $\endgroup$
    – Chris
    Jun 20, 2021 at 4:23
  • $\begingroup$ 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 ;) $\endgroup$
    – Chris
    Jun 20, 2021 at 11:14
  • 1
    $\begingroup$ @Chris Oh, right, didn't notice it, it sure looks weird :p $\endgroup$
    – Gorgious
    Jun 20, 2021 at 12:17
  • $\begingroup$ Really...i the first second i thought: OMG, Gorgious is a genius. He made custom nodes for geometry nodes.... :) $\endgroup$
    – Chris
    Jun 20, 2021 at 12:21
12
$\begingroup$

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

enter image description here

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

enter image description here

$\endgroup$
3
  • $\begingroup$ niiiiiiiiiiiiiiiice!!!! $\endgroup$
    – Chris
    Jun 20, 2021 at 4:25
  • $\begingroup$ @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. $\endgroup$
    – Robin Betts
    Jun 20, 2021 at 8:08
  • $\begingroup$ Looks like the user doesn't often accept answer $\endgroup$
    – Chris
    Jun 20, 2021 at 8:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .