Imagine you are making a geometry nodes setup for generating crowds of people. Every person is different. Some are tall, some are short, and most are somewhere in between. So how do you decide on the height of each person? One approach would be to use a “Random Value” node centered on 1.75 meters. That means setting a minimum of 1.5 meters (shortest possible) and a maximum of 2 meters (tallest possible). Here’s what that would look like, except it is a 100*100 grid with a random distribution on the z-axis:
As you might have guessed, this isn’t a realistic result. In reality, there are people who are outside our height range. Also, in real life there are more average height people than very tall or very short people.
Another approach might be to use a noise texture. This is a better choice, since it will generate more average height people than very tall or very short people. Still though, there is an arbitrary minimum and a maximum height for people, which isn’t realistic:
What we need is a “Normal Distribution Node”. Rather than generating an even distribution of random values between two numbers, we could just provide it a mean value and a standard distribution. I made one, and here’s the result:
The random samples are generated using the “Box-Müller Transform”, which takes two random uniformly numbers distributed numbers and outputs a pair of normally distributed numbers. I learned how to make it work from this YouTube video. Here’s what the nodes look like:
Probably, there’s a lot of room for improvement, but it gives me the results I want. I’d like to know what you think! Maybe you have some ideas?
CORRECTION: The “Standard Distribution” node should be renamed to “Normal/Gaussian Distribution”.
EDIT: The original node setup I posted had multiple issues (now fixed, hopefully). I should have waited before posting it so I could have worked out the details. I’ve updated the screenshot of the node setup. There’s still one mystery for me. It seems I need to multiply the input standard deviation by about 0.62 to get the correct standard deviation (at least according to the “Attribute Statistic” node). Here’s the .blend file:
NormalDistNode.blend (936.0 KB)