4
$\begingroup$

So, I just finished a procedure for mountain texture and I need to scatter trees only in places under the snow areas.

My idea was to use the same method as I did for mapping the snow in the shader editor with a texture coordinate --> separate xyz --> color ramp, but geometry nodes don't support texture coordinates.

Is there any way to add trees only in the green areas under the snow?

I need trees in the green areas.

$\endgroup$

1 Answer 1

4
$\begingroup$

You have at least two different options here:

  • Either you distribute your instances with the help of an image texture.
  • Or you distribute your instances according to the Z-position of your terrain.

Your question refers to the variant with the image texture:

enter image description here

  1. Get your terrain with Object Info.

  2. The node Bounding Box gives you the minimum and maximum position/extension of this mesh.

  3. With Map Range you can now map the position of the faces of this range into another one. In this case the image texture needs a range from $(0,0,0)$ to $(1,1,0)$ as input.

  4. You can then feed the result as a vector into the Image Texture node that contains your image.

  5. Depending on the colors of the image, you can now make comparisons which create a selection.

  6. Based on this selection you create the points for your instances with the node Distribute Points on Faces.

  7. At these points you can then instantiate your trees, swimming pools, or whatever with Instance on Points.


The other variant works directly with the Z-position of the terrain:

enter image description here

  1. Here you simply separate the Z-position with Separate XYZ and directly compare this value with a value of your choice.

  2. With this selection you continue as in the example above...

$\endgroup$
2
  • 1
    $\begingroup$ just as addition: if he would have set the material with GN, you can also separate/select by material like this: [1]: i.stack.imgur.com/usCr9.png (Material selection node). Maybe result: [1]: i.stack.imgur.com/50Aaw.jpg -> distributing just on green the "trees" $\endgroup$
    – Chris
    Jul 7 at 9:58
  • 1
    $\begingroup$ @Chris Thank you for this valuable tip! $\endgroup$ Jul 7 at 13:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.