Evenly distribute points on a triangle mesh

Started by
15 comments, last by alvaro 12 years, 11 months ago
Unwrap the model and do poisson disk sampling on the 2d (texture?) and then transform the points back to 3d
Advertisement

Unwrap the model and do poisson disk sampling on the 2d (texture?) and then transform the points back to 3d


I don't know how to define unwrapping for an arbitrary mesh... Do you have a definition?
Unwrapping is fairly easy (assuming you're talking about using the UVs), but going back is going to be difficult (without some kind of helper data that will be larger than my simple list of weights). And it only really works if you actually have UVs, and if the texel density is consistent across the mesh.

One more point about my original suggestion: After computing the normalized triangle weights, you should do a single linear pass to compute the cumulative weight. That will let you switch to binary (rather than linear) search when you need to pick a triangle. Of course, if you really don't care that much, you can just assume that all triangles are weighted evenly, and pick one at random. That also works if you can massage the data coming in (tesselate or weld triangles to get the maximum area difference down to some tolerable threshold).

[quote name='Katachi' timestamp='1305817470' post='4813020']
[quote name='alvaro' timestamp='1305814296' post='4812997']
By the way, why do you want to do this?

[...]

I need an even distribution of particles on the surface.
[/quote]

That's not an answer.
[/quote]

That's the answer you have to live with. It's confidential.
A few years ago my brother was working for the Namibian government trying to improve the conditions of bushmen that had been given land but didn't know what to do with it (they are nomadic). Through two translators (English <-> Afrikaans and Afrikaans <-> some San language), he spent a full day talking to the elders, trying to understand their situation to see how he could best help them.

The conversation went something like this:
- What is the main problem facing your community?
- We need a well.
- That's not a problem, but one possible solution to a problem. What is the problem?
- We don't understand.
- OK. Let me explain it with an example. If I am growing lettuce and my neighbor has free-roaming cows that eat them, I might think that I need a fence. But that's not really my problem: The problem is that my neighbor's cows are eating my lettuce. A fence is one possible solution, but perhaps we could tie the cows, or we could move them somewhere else.
- Oh, that's a good example.
- So what is the main problem you have?
- That we don't have a well.

Although we don't have the huge language barriers or the deep cultural differences that were probably the cause of the lack of understanding in my brother's case, for a moment there I was feeling his frustration. :)

In case you are interested in the end of the story, the Ministry of Lands wanted to build wells because the number of wells built is an easy statistic to give the president and it makes them look good, even though wells are often not the most cost-effective way of providing water (one could organize a distribution system and have several villages share a well), and water shortage might not even have been their main problem (not knowing how to farm was probably a bigger long-term concern). So I think they ended up getting their well.

I need an even distribution of particles on the surface.

Now if I think about it, the optimal algorithm is probably different depending how many particles you plan to add, compared to the complexity of original mesh. If there are many more particles than there are the triangles in original mesh, then equalizing the shortest path between neighboring points is sufficient. If there are less points (or there are parts with vastly different complexity), you have to equalize the surface area of the original mesh covered by each triangle of the new mesh.
For example - take dumbbell mesh, and try to place 8 points over it. You will have a solution, where all points form a "cube" at the one end of dumbbell with the distances between points being equal. But one side of the "cube" will have vastly different area.
Lauris Kaplinski

First technology demo of my game Shinya is out: http://lauris.kaplinski.com/shinya
Khayyam 3D - a freeware poser and scene builder application: http://khayyam.kaplinski.com/
Yes, you could make the smallest distance be as large as possible, or you could make the largest area of a polygon in the Voronoi diagram be as small as possible, or the smallest angle in a Delaunay triangulation be as large as possible. These all fit "evenly distributed" in some sense, but there is no way to know what the OP means without explaining what he wants the points for. He's already said he cannot tell us, so I don't feel inclined to put any more effort into helping him.

This topic is closed to new replies.

Advertisement