4
$\begingroup$

I am trying to instance rocks on an open field. Part of the instancing involves randomizing the scale of the rocks.

What I hope to achieve is to skew the distribution of the random values towards smaller values such that there will be more small rocks instanced than big rocks (i.e. more small random values than large ones).

This is my current node setup: node setup

I have tried putting a Color Ramp node between the "Random Value" node and the "Instance on Points" node. All it did was to switch the rocks instance on and off.

TL;DR

I want to instance more small rocks than big rocks by skewing the distribution of the random values generated towards smaller values, and then plugging those into the scale of the rocks. How do I go about doing that?

$\endgroup$

3 Answers 3

5
$\begingroup$

One possible way to do so is use a random boolean value with "probability" like this:

enter image description here

changing the probability results in:

enter image description here

$\endgroup$
6
$\begingroup$

One way would be to make no attempt to change Random Value's distribution of values, but instead, choose some non-linear mapping of its evenly-distributed output.

That could be any math function, or manually constructed ones, such as a Color Ramp, or Vector Curves, for independent adjustment in each dimension, or, as here, RGB Curves, which make mapping uniform scaling slightly easier?

enter image description here

(The 'big-rock' spike could be anywhere in the 0-1 curve; all that matters is its width)

$\endgroup$
6
  • $\begingroup$ Oh, that's an idea as well... a visual control is sometimes better than just seeing the numbers. $\endgroup$ Mar 1, 2022 at 15:15
  • $\begingroup$ @GordonBrinkmann The interesting one would be procedural bias by external features.. big at the bottom of the cliff... finer to coarser on the beach.. $\endgroup$
    – Robin Betts
    Mar 1, 2022 at 15:18
  • $\begingroup$ I guess this could be achieved depending on how cliff and beach are realized... maybe a height map, the absolute Z location or steepness of faces? Or a combination of those parameters... and maybe a weight map as well. $\endgroup$ Mar 1, 2022 at 15:21
  • $\begingroup$ @GordonBrinkmann I've been trying something like 'directed AO' to do this in shader-land. No real luck yet. $\endgroup$
    – Robin Betts
    Mar 1, 2022 at 15:24
  • $\begingroup$ Works great until you accidently point the curve towards infinity and it bricks your computer. Definitely recommend clamping. $\endgroup$ May 15, 2022 at 2:29
3
$\begingroup$

I only have a workaround for that. The solution here is Power. To change a linear distribution in the 0 to 1 range, a good way is to use a Math node set to Power. If you set an Exponent > 1, the lower values will be "broadened" until you finally reach 1.

Here is an example how this looks: the Vector Math > Length creates a value between 0 and 1 here from the center to the border of the plane. Then I used a Map Range to convert it to your desired range of 0.01 to 0.1 values. On the left, it is simply the length mapped to the target range in a linear distribution On the right, the 0 to 1 range is squared by using a Power node with an Exponent of 2. If you plug both into a Less Than node with a Threshold of 0.1 the result is the same, the maximum value of 0.1 is reached at the border of the plane.

linear distribution

However, if you lower the Threshold in the Less Than to 0.05 for example, the left plane shows a significantly smaller white circle than the right plane, which means that the area with values below 0.05 is larger on the right side than on the left.

exponential distribution

You can increase this difference if you set a higher exponent like 3, 4 or maybe 16:

compare exponential distribution

You can take it even further, the higher the exponent the smaller the area of high values. Now to use that in your Geometry Nodes setup, instead of setting the Random Value node to a Min of 0.01 and Max of 0.1, you use 0 and 1 instead, then plug a Power node and a Map Range afterwards to get this distribution.

Below you can see the mathematical equations which correspond to the different settings in the comparison image above. As you can see, the higher the exponent, the more values you get in the lower range:

exponential equations

$\endgroup$

You must log in to answer this question.

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