Uniform, blue noise placement of particles

I wanted to try render grass using visual effect graph and I would like it to be as performant as possible.
One of things I want to try to improve is reduction of particles.
Currently I spawn them randomly with box, so some particles can be spawned very close to each other and cause additional overdraw, but also create greater gaps without grass.


The idea is to use blue noise / poisson disc sampling or something similar to ensure grass is distributed evenly, but also randomly. The thing is I am not sure how to implement this, especially since the final position source will not be just box/squre, but texture (I mean mask texture) or mesh (maybe with vertex color).

How to tackle this problem?
Is there someone who tried to implement position sampling in such a way or can point me towards solution?

I dont work a lot with textures but I may have an idea
Also excuse me, I didnt exactly understand the problem you are facing but something sparked in my brain so here you go:
How about spawn all of them in the same place first then displace them based on the current x,y value on the blue noise, if the blue noise value is below a certain value, that spot wont have anything

Hi! It seems like a good use case for rejection sampling:

  • Spawn particle candidates sequentially
  • Use a texture lookup to discard/accept particle by setting its “alive” attribute in Init.

Condition can be as simple as checking the sampled texture value is above a threshold.
It can also be treated as a density map, where the texel value is compared against a random 0-1 value.

More over if you plan on using a mask texture for the spawning, it’s already rejection sampling, so it’s only a matter of modulating the mask texture loopup with your noise texture.

An alternative would be to generate points using some low discrepency sequence (see Halton, Hammersley etc.)

Another idea would be to spawn your points on a uniform grid an apply a random offset of cell size for each of them.

Question here, if I set alive to false during initialization, but particles have undefined lifetime, plus Update context has disabled reaping particles, will those rejected particles be actually killed?
The thing is how would I do it with mesh? I think I am gonna end up with mesh as source.

This could be the way, might try to see how it looks like, but still, this is simple for square, but complicated for irregular mesh.

I think the perfect solution would be if there was way to spawn them sequentially with blue noise patter using mentioned algorithm or something like that, but I think about alternative - to create tool and “paint” spawn points manually. This still allows generation of points from some source, but also gives full control. The thing is I doubt I need such a thing.