Jump to content
  • Advertisement
Sign in to follow this  
TriML

distributing points over the surface

This topic is 4609 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a model loaded in a directx app and generating poinsts randomly over the model surface. I want to arrange these points as to be placed uniformly over the surface not as most points in one triange and none in other. How can this be acheived? Thanks

Share this post


Link to post
Share on other sites
Advertisement
First randomly pick the triangle, weighted by the area of each triangle. Then uniformly sample a random point within the triangle. Tell me if you need help with either of these steps.

Share this post


Link to post
Share on other sites
You can get better results with that method if you stratify points in the rectangle containing the triangle, then fold them back over.

The best way to do a uniform point distribution on the surface of a mesh is to use point repulsion.

First, randomly distribute points on your mesh, then have each point be repelled by its neighbours with a force inversely proportional to the distance between the points. Do this repulsion process in a number of iterative steps, say 5-10, taking care to keep the points constrained to the mesh, and you will end up with something close to a poission distribution (i.e. all points are roughly equidistant from each other).

Share this post


Link to post
Share on other sites
Quote:
Original post by playmesumch00ns
You can get better results with that method if you stratify points in the rectangle containing the triangle, then fold them back over.

Well, the parallelogram containing the triangle, not the rectangle containing the triangle. But yeah, that's the standard method for uniform sampling within a triangle. As for the iterative relaxation you suggest... TriML, do you want points randomly distributed but overall uniformly distributed, or do you want them in as uniform a manner (think geodesic spheres) as possible?

Share this post


Link to post
Share on other sites
Thanks for the replies

Sneftel:
What i m currently doing is picking a triangle randomly from the list of all triangles of the mesh, dont know about area-weighted...and then generating a point randomly in this triangle. This is fine, points are being generated on the surface of the model but they are not enenly distributed.

playmesumch00ns:
So for point repulsion, i have to calculate the force between points. Can u explain it a little?

Share this post


Link to post
Share on other sites
Quote:
Original post by Sneftel
do you want points randomly distributed but overall uniformly distributed


yes that's the case

Share this post


Link to post
Share on other sites
Quote:
Original post by TriML
What i m currently doing is picking a triangle randomly from the list of all triangles of the mesh, dont know about area-weighted.


Area weighting is important. Otherwise, most points are going to end up in high-poly regions like faces.

Share this post


Link to post
Share on other sites
Quote:
Original post by Sneftel
Area weighting is important. Otherwise, most points are going to end up in high-poly regions like faces.


hmm... and how can i do that? and will it produce points uniform on the surface?

Share this post


Link to post
Share on other sites
say you got three triangles (t1,t2,t3) the first two of which are 1 square meter and the third is 3 square meter. so you pick a triangle based on these probability

p(t1) = 1/(3+1+1) = 1/5
p(t2) = 1/5
p(t3) = 3/5

there are many ways to do this. the most straightforward way is when you know how many samples you want to take. say I know I want to take 10,000 samples. I just simply do this.

sample t1 10000*1/5 times
sample t3 10000*3/5 times
etc etc.

Tim

Share this post


Link to post
Share on other sites
Look at it like throwing darts at a dartboard. You have a smaller chance of hitting the bullseye because it is smaller. Throwing darts doesn't result in a uniform distribution but it serves to show intuitively that your chance depends upon the area.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!