Input: Triangles which make up an arbitrary shape. Each triangle is represented by 3 3D points.
Output: A set of particles which fills up the inside of the object (see image).
I have read the description made by GPU-Gems, and tried to implement the proposed solution that don't make the computations on the GPU. I have tried to take each triangle one at a time and see if they intersect with lines, and if so store the z-value which I later used to generate particles. This gave bad results, and in theory it is possible for a line to intersect with a lone point which would cause a bug.
Can anyone tell me how to easily on the CPU side create a set of particles that represent a shape? Where the shape is defined as a set of triangles.
I prefer a solution that is simple and works well rather than an efficient solution that can have bugs.
Edit: I re-checked my code, and I found that I was not sorting the z-value arrays correctly like I thought I did, after fixing this I got a good result! If anyone still wants to answer this question that is ok, but I consider my problem to be solved now.