- Home /
Particle distribution on mesh: How to implement a density map?
I'm trying to control the density of particles across a mesh when using a mesh-shape for the emitter. I have vertex colors on the original mesh to be used for the density map and need help on finding a good approach to the problem.
My current idea is to iterate through the triangles in the mesh and calculate a percentage of the surface area for that triangle compared to the entire mesh. Then multiply that percentage with the averaged density (vertex color) of the 3 vertices for that triangle to get a particle count(percentage) for the triangle. Finally I would randomly distribute the particles on the triangle.
I think the main problem with this approach that the density will be per triangle, so large triangles where the vertices have different colors won't get a nice 'gradient' distribution.
Input appreciated.
Are you writing your own particle system, or are you planning to instantiate particle emitters over the faces of the mesh?
I'm using unity particles, only want to tweak the distribution a bit. $$anonymous$$ost likely I'll use SetParticles and the $$anonymous$$esh interface to distribute the particles.
Hi, did you ever design an efficient implementation? Would be interested in hearing how you accomplished it. O