1
\$\begingroup\$

I'm creating a space game in Godot that has procedurally generated nebulae. A nebula is comprised of between 50 and 200 child particles, all with the same shader assigned to them which creates an effect as follows:

https://gyazo.com/41aa6fb9695a626ece10f7aff144ecba

My issue is that the more particles that are placed, the more the nebula itself starts to resemble a square shape.

I want to be able to place these particles in a way that more closely resembles a cloud formation, which I imagine will use some sort of noise function (Perlin, Simplex?) to do so - but I've only ever used noise for generating graphics, not placing items.

The parent object of the particles can vary in size, as can the number of particles placed within it.

How would I place these particles randomly, while ensuring they more closely resemble cloud formations?

The language I'm using is C#, but Pseudocode is more than fine.

\$\endgroup\$
1
  • \$\begingroup\$ Clouds come in a lot of strange shapes. Can you include an example or two of the kind of cloud formation you want to imitate? \$\endgroup\$
    – DMGregory
    May 28, 2019 at 11:57

1 Answer 1

1
\$\begingroup\$

The simplest solution would be to use a Gaussian random variable for the x, y and z (if 3d) coordinates. It won't be as inhomogeneous as your example image though (see below on how to improve), but it could work well if you have only 50-200 elements. You can generate Gaussian random variables combining uniform random variables, see here for example (first answer)

https://stackoverflow.com/questions/218060/random-gaussian-variables/218600#218600

A Gaussian random variable will generate a cloud that has a decreasing density. To improve inhomogeneity, you could combine several gaussians together, each with different mean and variance. You might also want to cut points outside a maximal radius.

\$\endgroup\$

You must log in to answer this question.

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